{"_id":"typed-assert","_rev":"370001","name":"typed-assert","description":"typesafe assertion library for TypeScript 3.7+","dist-tags":{"latest":"1.0.8"},"maintainers":[{"name":"elie.rotenberg","email":"elie@rotenberg.io"}],"time":{"modified":"2021-07-26T06:55:25.000Z","created":"2020-06-11T15:07:58.064Z","1.0.8":"2021-07-02T15:43:41.528Z","1.0.7":"2021-01-05T10:11:15.389Z","1.0.6":"2020-11-17T13:37:08.832Z","1.0.5":"2020-11-14T08:56:15.659Z","1.0.4":"2020-07-13T19:14:23.048Z","1.0.3":"2020-07-13T13:51:55.527Z","1.0.2":"2020-06-11T15:07:58.064Z"},"users":{},"author":{"name":"Elie Rotenberg","email":"elie@rotenberg.io"},"repository":{"type":"git","url":"git+https://github.com/elierotenberg/typed-assert.git"},"versions":{"1.0.8":{"name":"typed-assert","version":"1.0.8","description":"typesafe assertion library for TypeScript 3.7+","main":"build/index.js","scripts":{"test:src":"jest src/**/*.test.ts","test:build":"jest build/**/*.test.js","clean:doc":"rm -rf doc && rm -rf API.md","build:doc":"npm run clean:doc && typedoc && sed s/README.md/API.md/ doc/README.md > API.md && rm -rf doc","clean:ts":"rm -rf build","build:ts":"npm run clean:ts && tsc -p .","build":"npm run build:doc && npm run build:ts"},"repository":{"type":"git","url":"git+https://github.com/elierotenberg/typed-assert.git"},"keywords":["assert","typescript"],"author":{"name":"Elie Rotenberg","email":"elie@rotenberg.io"},"license":"MIT","bugs":{"url":"https://github.com/elierotenberg/typed-assert/issues"},"homepage":"https://github.com/elierotenberg/typed-assert#readme","devDependencies":{"@types/jest":"^26.0.23","@types/node":"^15.14.0","@typescript-eslint/eslint-plugin":"^4.28.1","@typescript-eslint/parser":"^4.28.1","eslint":"^7.29.0","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.23.4","eslint-plugin-prettier":"^3.4.0","jest":"^27.0.6","prettier":"^2.3.2","ts-jest":"^27.0.3","typedoc":"^0.21.2","typedoc-plugin-markdown":"^3.10.2","typescript":"^4.3.5"},"gitHead":"cd876a901619003d7a58b76ac3c849fd661eca1a","_id":"typed-assert@1.0.8","_nodeVersion":"16.0.0","_npmVersion":"7.10.0","dist":{"shasum":"4bf9f1ce7f3f974d09c3afd7c68d12e1391a233c","size":24019,"noattachment":false,"key":"/typed-assert/-/typed-assert-1.0.8.tgz","tarball":"http://registry.cnpm.dingdandao.com/typed-assert/download/typed-assert-1.0.8.tgz"},"_npmUser":{"name":"elie.rotenberg","email":"elie@rotenberg.io"},"directories":{},"maintainers":[{"name":"elie.rotenberg","email":"elie@rotenberg.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typed-assert_1.0.8_1625240621374_0.7917689216254378"},"_hasShrinkwrap":false,"publish_time":1625240621528,"_cnpm_publish_time":1625240621528},"1.0.7":{"name":"typed-assert","version":"1.0.7","description":"typesafe assertion library for TypeScript 3.7+","main":"build/index.js","scripts":{"test:src":"jest src/**/*.test.ts","test:build":"jest build/**/*.test.js","clean:doc":"rm -rf doc && rm -rf API.md","build:doc":"npm run clean:doc && typedoc && sed s/README.md/API.md/ doc/README.md > API.md && rm -rf doc","clean:ts":"rm -rf build","build:ts":"npm run clean:ts && tsc -p .","build":"npm run build:doc && npm run build:ts"},"repository":{"type":"git","url":"git+https://github.com/elierotenberg/typed-assert.git"},"keywords":["assert","typescript"],"author":{"name":"Elie Rotenberg","email":"elie@rotenberg.io"},"license":"MIT","bugs":{"url":"https://github.com/elierotenberg/typed-assert/issues"},"homepage":"https://github.com/elierotenberg/typed-assert#readme","devDependencies":{"@types/jest":"^26.0.19","@types/node":"^14.14.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","jest":"^26.6.3","prettier":"^2.2.1","ts-jest":"^26.4.4","typedoc":"^0.20.12","typedoc-plugin-markdown":"^3.2.1","typescript":"^4.1.3"},"gitHead":"4f04df2a3b61757c42ca5e36b56619dd067c3337","_id":"typed-assert@1.0.7","_nodeVersion":"15.5.0","_npmVersion":"7.3.0","dist":{"shasum":"30bb56ace265736fc3075b07414028077f77a8e2","size":25489,"noattachment":false,"key":"/typed-assert/-/typed-assert-1.0.7.tgz","tarball":"http://registry.cnpm.dingdandao.com/typed-assert/download/typed-assert-1.0.7.tgz"},"_npmUser":{"name":"elie.rotenberg","email":"elie@rotenberg.io"},"directories":{},"maintainers":[{"name":"elie.rotenberg","email":"elie@rotenberg.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typed-assert_1.0.7_1609841475208_0.19896452688040656"},"_hasShrinkwrap":false,"publish_time":1609841475389,"_cnpm_publish_time":1609841475389},"1.0.6":{"name":"typed-assert","version":"1.0.6","description":"typesafe assertion library for TypeScript 3.7+","main":"build/index.js","scripts":{"test":"jest","clean:doc":"rm -rf doc && rm -rf API.md","build:doc":"npm run clean:doc && typedoc && sed s/README.md/API.md/ doc/README.md > API.md && rm -rf doc","clean:ts":"rm -rf build","build:ts":"npm run clean:ts && tsc -p .","build":"npm run build:doc && npm run build:ts"},"repository":{"type":"git","url":"git+https://github.com/elierotenberg/typed-assert.git"},"keywords":["assert","typescript"],"author":{"name":"Elie Rotenberg","email":"elie@rotenberg.io"},"license":"MIT","bugs":{"url":"https://github.com/elierotenberg/typed-assert/issues"},"homepage":"https://github.com/elierotenberg/typed-assert#readme","devDependencies":{"@types/jest":"^26.0.15","@types/node":"^14.14.7","@typescript-eslint/eslint-plugin":"^4.7.0","@typescript-eslint/parser":"^4.7.0","eslint":"^7.13.0","eslint-config-prettier":"^6.15.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","jest":"^26.6.3","prettier":"^2.1.2","ts-jest":"^26.4.4","typedoc":"^0.19.2","typedoc-plugin-markdown":"^3.0.11","typescript":"^4.0.5"},"gitHead":"e9dfbf4333f6914241ad81dc7efd0899099376de","_id":"typed-assert@1.0.6","_nodeVersion":"15.0.0","_npmVersion":"7.0.2","dist":{"shasum":"9e56e91645b83eb88d33696b6152e8bedf59e924","size":23788,"noattachment":false,"key":"/typed-assert/-/typed-assert-1.0.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/typed-assert/download/typed-assert-1.0.6.tgz"},"_npmUser":{"name":"elie.rotenberg","email":"elie@rotenberg.io"},"directories":{},"maintainers":[{"name":"elie.rotenberg","email":"elie@rotenberg.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typed-assert_1.0.6_1605620228696_0.36071696282572163"},"_hasShrinkwrap":false,"publish_time":1605620228832,"_cnpm_publish_time":1605620228832},"1.0.5":{"name":"typed-assert","version":"1.0.5","description":"typesafe assertion library for TypeScript 3.7+","main":"build/index.js","scripts":{"test":"jest","clean:doc":"rm -rf doc && rm -rf API.md","build:doc":"npm run clean:doc && typedoc && sed s/README.md/API.md/ doc/README.md > API.md && rm -rf doc","clean:ts":"rm -rf build","build:ts":"npm run clean:ts && tsc -p .","build":"npm run build:doc && npm run build:ts"},"repository":{"type":"git","url":"git+https://github.com/elierotenberg/typed-assert.git"},"keywords":["assert","typescript"],"author":{"name":"Elie Rotenberg","email":"elie@rotenberg.io"},"license":"MIT","bugs":{"url":"https://github.com/elierotenberg/typed-assert/issues"},"homepage":"https://github.com/elierotenberg/typed-assert#readme","devDependencies":{"@types/jest":"^26.0.15","@types/node":"^14.14.7","@typescript-eslint/eslint-plugin":"^4.7.0","@typescript-eslint/parser":"^4.7.0","eslint":"^7.13.0","eslint-config-prettier":"^6.15.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","jest":"^26.6.3","prettier":"^2.1.2","ts-jest":"^26.4.4","typedoc":"^0.19.2","typedoc-plugin-markdown":"^3.0.11","typescript":"^4.0.5"},"gitHead":"c53817e7fa98038c3e6c02b5b411a141c01c6bb1","_id":"typed-assert@1.0.5","_nodeVersion":"15.0.0","_npmVersion":"7.0.2","dist":{"shasum":"6442da5ffb1982820d504c4bcaffa5f20ddbcc80","size":23655,"noattachment":false,"key":"/typed-assert/-/typed-assert-1.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/typed-assert/download/typed-assert-1.0.5.tgz"},"_npmUser":{"name":"elie.rotenberg","email":"elie@rotenberg.io"},"directories":{},"maintainers":[{"name":"elie.rotenberg","email":"elie@rotenberg.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typed-assert_1.0.5_1605344175496_0.6468886217683116"},"_hasShrinkwrap":false,"publish_time":1605344175659,"_cnpm_publish_time":1605344175659},"1.0.4":{"name":"typed-assert","version":"1.0.4","description":"typesafe assertion library for TypeScript 3.7+","main":"build/index.js","scripts":{"test":"jest","clean:doc":"rm -rf doc && rm -rf API.md","build:doc":"npm run clean:doc && typedoc && sed s/README.md/API.md/ doc/README.md > API.md && rm -rf doc","clean:ts":"rm -rf build","build:ts":"npm run clean:ts && tsc -p .","build":"npm run build:doc && npm run build:ts"},"repository":{"type":"git","url":"git+https://github.com/elierotenberg/typed-assert.git"},"keywords":["assert","typescript"],"author":{"name":"Elie Rotenberg","email":"elie@rotenberg.io"},"license":"MIT","bugs":{"url":"https://github.com/elierotenberg/typed-assert/issues"},"homepage":"https://github.com/elierotenberg/typed-assert#readme","devDependencies":{"@types/node":"^14.0.22","@types/jest":"^26.0.4","@typescript-eslint/eslint-plugin":"^3.6.0","@typescript-eslint/parser":"^3.6.0","eslint-config-prettier":"^6.11.0","eslint-plugin-import":"^2.22.0","eslint-plugin-prettier":"^3.1.4","eslint":"^7.4.0","jest":"^26.1.0","prettier":"^2.0.5","ts-jest":"^26.1.2","typedoc":"^0.17.8","typescript":"^3.9.6","typedoc-plugin-markdown":"^2.3.1"},"gitHead":"d9442fd34b89c16253e3761769e7afd2b76fa152","_id":"typed-assert@1.0.4","_nodeVersion":"12.18.0","_npmVersion":"6.14.4","dist":{"shasum":"8e833a27895d9cd744241a0f47e940c92beeb92d","size":28101,"noattachment":false,"key":"/typed-assert/-/typed-assert-1.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/typed-assert/download/typed-assert-1.0.4.tgz"},"maintainers":[{"name":"elie.rotenberg","email":"elie@rotenberg.io"}],"_npmUser":{"name":"elie.rotenberg","email":"elie@rotenberg.io"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typed-assert_1.0.4_1594667662929_0.04817641000391881"},"_hasShrinkwrap":false,"publish_time":1594667663048,"_cnpm_publish_time":1594667663048},"1.0.3":{"name":"typed-assert","version":"1.0.3","description":"typesafe assertion library for TypeScript 3.7+","main":"build/index.js","scripts":{"test":"jest","clean:doc":"rm -rf doc && rm -rf API.md","build:doc":"npm run clean:doc && typedoc && sed s/README.md/API.md/ doc/README.md > API.md && rm -rf doc","clean:ts":"rm -rf build","build:ts":"npm run clean:ts && tsc -p .","build":"npm run build:doc && npm run build:ts"},"repository":{"type":"git","url":"git+https://github.com/elierotenberg/typed-assert.git"},"keywords":["assert","typescript"],"author":{"name":"Elie Rotenberg","email":"elie@rotenberg.io"},"license":"MIT","bugs":{"url":"https://github.com/elierotenberg/typed-assert/issues"},"homepage":"https://github.com/elierotenberg/typed-assert#readme","devDependencies":{"@types/node":"^14.0.22","@types/jest":"^26.0.4","@typescript-eslint/eslint-plugin":"^3.6.0","@typescript-eslint/parser":"^3.6.0","eslint-config-prettier":"^6.11.0","eslint-plugin-import":"^2.22.0","eslint-plugin-prettier":"^3.1.4","eslint":"^7.4.0","jest":"^26.1.0","prettier":"^2.0.5","ts-jest":"^26.1.2","typedoc":"^0.17.8","typescript":"^3.9.6","typedoc-plugin-markdown":"^2.3.1"},"gitHead":"a272dbccfcab380222f076c5cce1513a454f50b9","_id":"typed-assert@1.0.3","_nodeVersion":"12.18.0","_npmVersion":"6.14.4","dist":{"shasum":"588131c6297544a42722f31a558b1e8f72f8d3d8","size":28108,"noattachment":false,"key":"/typed-assert/-/typed-assert-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/typed-assert/download/typed-assert-1.0.3.tgz"},"maintainers":[{"name":"elie.rotenberg","email":"elie@rotenberg.io"}],"_npmUser":{"name":"elie.rotenberg","email":"elie@rotenberg.io"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typed-assert_1.0.3_1594648315394_0.39505393945193124"},"_hasShrinkwrap":false,"publish_time":1594648315527,"_cnpm_publish_time":1594648315527},"1.0.2":{"name":"typed-assert","version":"1.0.2","description":"typesafe assertion library for TypeScript 3.7+","main":"build/index.js","scripts":{"test":"jest","clean:doc":"rm -rf doc && rm -rf API.md","build:doc":"npm run clean:doc && typedoc && sed s/README.md/API.md/ doc/README.md > API.md && rm -rf doc","clean:ts":"rm -rf build","build:ts":"npm run clean:ts && tsc -p .","build":"npm run build:doc && npm run build:ts"},"repository":{"type":"git","url":"git+https://github.com/elierotenberg/typed-assert.git"},"keywords":["assert","typescript"],"author":{"name":"Elie Rotenberg","email":"elie@rotenberg.io"},"license":"MIT","bugs":{"url":"https://github.com/elierotenberg/typed-assert/issues"},"homepage":"https://github.com/elierotenberg/typed-assert#readme","devDependencies":{"@types/node":"^14.0.13","@types/jest":"^26.0.0","@typescript-eslint/eslint-plugin":"^3.2.0","@typescript-eslint/parser":"^3.2.0","eslint-config-prettier":"^6.11.0","eslint-plugin-import":"^2.21.2","eslint-plugin-prettier":"^3.1.3","eslint":"^7.2.0","jest":"^26.0.1","prettier":"^2.0.5","ts-jest":"^26.1.0","typedoc":"^0.17.7","typescript":"^3.9.5","typedoc-plugin-markdown":"^2.3.1"},"gitHead":"c224ed2e9244c92720ef81529c0bbc4c1d67054c","_id":"typed-assert@1.0.2","_nodeVersion":"13.9.0","_npmVersion":"6.13.7","dist":{"shasum":"9a49833074f6cadf3ae110f16b65d362181d2760","size":27791,"noattachment":false,"key":"/typed-assert/-/typed-assert-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/typed-assert/download/typed-assert-1.0.2.tgz"},"maintainers":[{"name":"elie.rotenberg","email":"elie@rotenberg.io"}],"_npmUser":{"name":"elie.rotenberg","email":"elie@rotenberg.io"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typed-assert_1.0.2_1591888077961_0.8939311653713755"},"_hasShrinkwrap":false,"publish_time":1591888078064,"_cnpm_publish_time":1591888078064}},"readme":"# `typed-assert`\n\n`typed-assert` is a typesafe assertion library implementing the [TS 3.7 Assertion Functions](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions) API, without external dependencies.\n\nSee the [documentation](API.md).\n\n### Install\n\n```npm install typed-assert```\n\nor\n\n```yarn add typed-assert```\n\n### Why is it useful?\n\n`typed-assert` promotes using `unknown` instead of `any` for \"untrusted\" values, e.g. user input, while still benefiting from incremental typing.\n\nFor example, `JSON.stringify` returns `any`, which is not typesafe. With `typed-assert`, we can instead treat the result as `unknown` and gradually check the contents at runtime and still get correct type inference:\n\n```ts\nimport * as t from \"typed-assert\";\n\nconst parseConfigFile = (file: string): { readonly a: string, readonly b: number } => {\n  const contents = JSON.parse(fs.readFileSync(file, { encoding: 'utf8'})) as unknown;\n  // contents is \"unknown\" instead of any, because we don't trust the input yet\n  t.isRecord(contents);\n  // contents is \"Record<string, unknown>\"\n  t.isString(contents.a);\n  // contents.a is \"string\"\n  t.isNumber(contents.b):\n  // contents.b is \"number\";\n  return {\n    a: contents.a,\n    b: contents.b,\n  }; // correctly typed\n}\n```\n\n### How is it different from chai, jest.expect, etc?\n\n`typed-assert` is both a compile-time and runtime assert library. It leverages the `assertion function` feature of TypeScript to help the typechecker narrow the inferred types. In many cases, this significantly reduces the need to use `any`, and promotes using `unknown` instead.\n\nFor example:\n\n```ts\nconst u: unknown = {\n  a: \"value\",\n  b: 12,\n};\n\nchai.assert.typeOf(u, \"object\");\n// u is still \"unknown\"\nchai.assert.isNotNull(u);\n// u is still \"unknown\"\nchai.assert.typeof(u.a, \"string\");\n// TS Error (ts2571): u is \"unknown\"\n\nimport * as t from \"typed-assert\";\n\nt.isRecord(u);\n// u is Record<string, unknown>\nt.isString(u.a);\n// u.a is string\nt.isNumber(u.b);\n// u.b is number\n\nconst v: { a: string; b: number } = u;\n// no need to us `as ...`\n```\n\n### Usage\n\n`typed-assert` comes with a set of common assertions, as well as assertion combinators and utilities.\n\nSee [the documentation](./API.md) for a full reference.\n\n```ts\nimport * as t from \"typed-assert\";\n\n// Base asserts\nt.isExactly(\"a\", \"a\");\nt.isNotUndefined(null);\nt.isNotNull(undefined);\n\n// Asserts combinators\nt.isOneOf(\"b\", [\"a\", \"b\", \"c\"]);\nt.isArrayOf([2, 3, 4], t.isNumber);\n\n// Custom composite checks\ninterface ICustomType {\n  readonly a: {\n    readonly b: \"c\";\n    readonly d: string;\n  };\n  readonly f?: number;\n}\n\nfunction assertCustomType(input: unknown): asserts input is ICustomType {\n  t.isRecordWithKeys(input, [\"a\", \"f\"]);\n  t.isRecordWithKeys(input.a, [\"b\", \"d\"]);\n  t.isExactly(input.a.b, \"c\");\n  t.isString(input.a.d);\n  t.isOption(input.f, t.isNumber);\n}\n\nconst v = {\n  a: {\n    b: \"c\",\n    d: \"\",\n  },\n};\nassertCustomType(v);\n```\n\nThis library also comes with a combinator to transform an assertion functions into a [type guard function](https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards):\n```ts\nconst checkNumber = t.check(t.isNumber);\ncheckNumber(1) === true;\ncheckNumber(\"\") === false;\n```\n\nIt is especially convenient when combined with functional operations such as `Array#filter`:\n```ts\nconst t = [\"a\", 3, \"c\", 4, null, 2]\n  .filter(t.check(t.isNumber))\n  .map(x => x % 2 === 0 ? x : null) // x: number\n  .filter(t.check(t.isNotNull));\n// t: number[] = [4, 2]\n```\n\nTo encourage using asserts when dealing with untrusted JSON input, the following function is also exported:\n```ts\nexport const safeJsonParse = (json: string): unknown =>\n  JSON.parse(json) as unknown;\n```\n\n### Configuration\n\nThis library is designed to work in the browser as well as in Node without external dependencies, and by default does not use the `assert` module from the Node stdlib, so it ships with a very basic `assert` implementation:\n```ts\nexport type WeakAssert = (input: unknown, message?: string) => void;\n\nexport const defaultAssert: WeakAssert = (condition, message) => {\n  if (!condition) {\n    throw new TypeError(message);\n  }\n};\n\n```\n\nIt is however possible to configure the library to use a provided base `assert` function, such as the native `assert` module:\n```ts\nimport * as t from \"typed-assert\";\nimport nodeAssert from \"assert\";\n\nt.setBaseAssert(nodeAssert);\n```\n\n### Caveats\n\nDue to limitations in the typechecker, there are syntactic restrictions in how to define and use type assertion functions. For example, you can not dynamically define an assertion function, even if it looks like a static definition.\n\nThus the following code won't compile:\n```ts\nfunction createIsExactly<T>(value: T): (input: unknown) => asserts input is T {\n  return function isExactly(input: unknown): asserts input is T {\n    t.isExactly(input, value);\n  };\n}\n// No problem so far\n\ncreateIsExactly(\"a\")(null);\n// Won't compile:\n// Assertions require the call target to be an\n//  identifier or qualified name.ts(2776)\n```\n\nFor similar reasons, it is not possible to use type-inferred arrow functions to define assertion functions:\n```ts\nconst isExactlyNull = (input: unknown): asserts input is null => assert(input === value);\n// No problem so far\n\nisExactlyNull(\"a\", null):\n// Won't compile:\n// Assertions require the call target to be an\n//  identifier or qualified name.ts(2776)\n```\n\nIt is however possible to use arrow function with explicit typing of the left-hand operand:\n```ts\nconst isExactlyNull: (input: unknown) => asserts input is null = (input) =>\n  assert(input === null);\n\nisExactlyNull(\"a\");\n// No problem\n```\n\nTo simplify the implementation,\n\nTo simplify this pattern, this library also exports the `Assert<Input, Output>` type as defined below:\n```ts\nexport type Assert<T> = (\n  input: unknown,\n  message?: string,\n) => asserts input is T;\n\nconst isExactlyNull: Assert<null> = (input) => assert(input === null);\n\nisExactlyNull(\"a\");\n// No problem\n```\n\nFor convenience, this library also exports the following types, used internally:\n\n```ts\nexport type WeakAssert = (input: unknown, message?: string) => void;\n\nexport type SubType<Input, Output> = Output extends Input ? Output : never;\n\nexport type Assert<Input = unknown, Output = Input> = (\n  input: Input,\n  message?: string,\n) => asserts input is SubType<Input, Output>;\n\nexport type Check<Input = unknown, Output = Input> = (\n  input: Input,\n) => input is SubType<Input, Output>;\n```\n\nThis way we can write:\n```ts\nconst isExactlyNull: Assert<unknown, null> = (input) =>\n  assert(input === null);\n\nisExactlyNull(\"a\");\n```\n","_attachments":{},"homepage":"https://github.com/elierotenberg/typed-assert#readme","bugs":{"url":"https://github.com/elierotenberg/typed-assert/issues"},"license":"MIT"}