Comment on page
⚙
How to import
Recommended way to import tsafe
On the browser bundle size must be kept in check, it is best to only import what you'll use.
import { assert } from "tsafe/assert";
import { typeGuard } from "tsafe/typeGuard";
//Type can be imported from the index
import type { ReturnType } from "tsafe";
If you are in Node or on Deno, bundle size is irrelevant, you should use a single import.
import { assert, typeGuard } from "tsafe";
import type { ReturnType } from "tsafe";
/deps.ts
export { assert, typeGuard } from "https://deno.land/x/[email protected]/mod.ts";
export type { ReturnType } from "https://deno.land/x/[email protected]/mod.ts";
import { assert, typeGuard } from "./deps.ts";
import type { ReturnType } from "./deps.ts";
Last modified 10mo ago