{"id":20517607,"url":"https://github.com/n1kk/typed-well","last_synced_at":"2026-06-05T17:31:43.754Z","repository":{"id":57383457,"uuid":"400482931","full_name":"n1kk/typed-well","owner":"n1kk","description":"A unit testing library for your TypeScript definitions.","archived":false,"fork":false,"pushed_at":"2022-03-17T00:00:38.000Z","size":1719,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-16T14:47:27.470Z","etag":null,"topics":["type-checks","type-definitions","type-jest","typescript","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/n1kk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-27T11:13:58.000Z","updated_at":"2022-06-03T13:01:01.000Z","dependencies_parsed_at":"2022-09-26T16:50:29.859Z","dependency_job_id":null,"html_url":"https://github.com/n1kk/typed-well","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n1kk%2Ftyped-well","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n1kk%2Ftyped-well/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n1kk%2Ftyped-well/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n1kk%2Ftyped-well/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/n1kk","download_url":"https://codeload.github.com/n1kk/typed-well/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242123173,"owners_count":20075344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["type-checks","type-definitions","type-jest","typescript","unit-testing"],"created_at":"2024-11-15T21:36:20.282Z","updated_at":"2026-06-05T17:31:43.705Z","avatar_url":"https://github.com/n1kk.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Typed-Well [![github repo](https://img.shields.io/github/package-json/v/n1kk/typed-well?color=informational\u0026label=github\u0026logo=github)](https://github.com/n1kk/typed-well) [![npm package](https://img.shields.io/npm/v/typed-well?color=informational\u0026logo=npm)](https://www.npmjs.com/package/typed-well)\n\nRealtime, zero dependency, human-readable library to write unit tests for your TypeScript definitions. Think of it as Jest for types with no extra tooling required.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/n1kk/typed-well/raw/master/assets/demo1.gif\" alt=\"demo\"\u003e\n\u003c/p\u003e\n\n## Installation\n\nInstall it via your favorite package manager:\n\n- `npm i -D typed-well`\n- `yarn add -D typed-well`\n- `pnpm add -D typed-well`\n\n### Requirements\n\n- Typescript 4.4 or above.\n\n## Usage\n\nThis library exposes a set of utilities neatly packed into a namespace `_` to prevent global scope pollution. To use them just import the namespace in your test file.\n\n```ts\nimport { _ } from \"typed-well\";\n```\n\nThe namespace doubles as a type that is a shortcut to the positive assertion.\n\n```ts\ntype test_suit =\n  | _\u003ctrue\u003e // positive assertion, same as below\n  | _.pass\u003ctrue\u003e // positive assertion, same as above\n  | _.false\u003cfalse\u003e; // negative assertion\n```\n\nUtilities mimic Jest's `expect` matchers, they are just a set of custom type definitions. It doesn't require you to install any additional tools or define your result expectations in comments for some parser to find. You just write a test and if check fails TS compiler will throw an error on that line, and your IDE will even highlight it.\n\n```ts\n// MyType.ts\nexport type EventHandler = (type: string, data?: any) =\u003e boolean;\n\n// MyType.specd.ts\nimport { _ } from \"typed-well\";\n\ntype test_suit =\n  | _\u003cexpect\u003cEventHandler, to.beInvocable\u003e\u003e\n  | _\u003cexpect\u003cEventHandler, to.acceptArguments\u003c[string, object]\u003e\u003e\u003e\n  | _\u003cexpect\u003cEventHandler, to.returnType\u003cvoid\u003e\u003e\u003e; // \u003c-- error, this will be highlighted\n```\n\n### Running tests\n\nSince it only requires `tsc` to run there are many ways to execute your tests. They probably are already running via your IDE, but if you want them to run from command like you can put them in their own files (e.g. `MyType.specd.ts`) and just run `tsc` on them. Dont forget to exclude them from regular typescript compilation target.\n\n```bash\ntsc --strict --noEmit **/*.specd.ts\n```\n\n## API\n\n- Assertions\n  - [`_\u003c test \u003e`](#-_-test-)\n  - [`_.pass\u003c test \u003e`](#-_pass-test-)\n  - [`_.fail\u003c test \u003e`](#-_fail-test-)\n  - [`_.not`](#-_not)\n- Expectations\n  - [`expect\u003c given, check \u003e`](#-expect-given-check-)\n  - [`expectReturnOf\u003c given, check \u003e`](#-expectreturnof-given-check-)\n  - [`expectParametersOf\u003c given, check \u003e`](#-expectparametersof-given-check-)\n  - [`expectKeysOf\u003c given, check \u003e`](#-expectkeysof-given-check-)\n  - [`expectValuesOf\u003c given, check \u003e`](#-expectvaluesof-given-check-)\n- Utils\n  - [`_.falsy`](#-_falsy)\n  - [`_.primitive`](#-_primitive)\n  - [`_.nullish`](#-_nullish)\n- Checks\n  - Comparison\n    - [`to.equalTo\u003c expected \u003e`](#-toequalto-expected-)\n    - [`to.be\u003c expected \u003e`](#-tobe-expected-)\n    - [`to.accept\u003c expected \u003e`](#-toaccept-expected-)\n    - [`to.beAssignableTo\u003c expected \u003e`](#-tobeassignableto-expected-)\n    - [`to.extend\u003c expected \u003e`](#-toextend-expected-)\n    - [`to.beExtendedBy\u003c expected \u003e`](#-tobeextendedby-expected-)\n  - Primitives\n    - [`to.beDefined`](#-tobedefined)\n    - [`to.beOptional`](#-tobeoptional)\n    - [`to.beNullish`](#-tobenullish)\n    - [`to.bePrimitive`](#-tobeprimitive)\n    - [`to.beLiteral`](#-tobeliteral)\n    - [`to.beNever`](#-tobenever)\n  - General\n    - [`to.beTruthy`](#-tobetruthy)\n    - [`to.beFalsy`](#-tobefalsy)\n    - [`to.beInvocable`](#-tobeinvocable)\n    - [`to.beNewable`](#-tobenewable)\n  - Strings\n    - [`to.startWith\u003c expected \u003e`](#-tostartwith-expected-)\n    - [`to.endWith\u003c expected \u003e`](#-toendwith-expected-)\n    - [`to.contain\u003c expected \u003e`](#-tocontain-expected-)\n  - Objects\n    - [`to.haveKeys\u003c expected \u003e`](#-tohavekeys-expected-)\n    - [`to.haveOnlyKeys\u003c expected \u003e`](#-tohaveonlykeys-expected-)\n    - [`to.haveFieldsThatAccept\u003c expected \u003e`](#-tohavefieldsthataccept-expected-)\n    - [`to.haveFieldsThatAcceptOnly\u003c expected \u003e`](#-tohavefieldsthatacceptonly-expected-)\n  - Arrays\n    - [`to.include\u003c expected \u003e`](#-toinclude-expected-)\n  - Functions\n    - [`to.returnType\u003c expected \u003e`](#-toreturn-expected-)\n    - [`to.returnTypeOnly\u003c expected \u003e`](#-toreturnonly-expected-)\n    - [`to.resolveTo\u003c expected \u003e`](#-toresolveto-expected-)\n    - [`to.resolveToOnly\u003c expected \u003e`](#-toresolvetoonly-expected-)\n    - [`to.acceptParameters\u003c expected \u003e`](#-toacceptparameters-expected-)\n    - [`to.acceptOnlyParameters\u003c expected \u003e`](#-toacceptonlyparameters-expected-)\n\n## # `_\u003c test \u003e`\n\nShortcut to a positive assertion [`_.pass\u003c expectation \u003e`](#-_pass-test-). Expects check type to resolve to `true`.\n\n```ts\ntype test = _\u003cexpect\u003c\"a\", to.beAssignableTo\u003cstring\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `_.pass\u003c test \u003e`\n\nPositive assertion. Expects check type to resolve to `true`.\n\n```ts\ntype test = _.pass\u003cexpect\u003c\"a\", to.beAssignableTo\u003cstring\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `_.fail\u003c test \u003e`\n\nNegative assertion. Expects check type to resolve to `false`.\n\n```ts\ntype test = _.fail\u003cexpect\u003c\"a\", to.beAssignableTo\u003cnumber\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `_.not`\n\nNegates the checks. It's a namespace that contains aliases to all the check types and negates the result. Can be used to write negative checks in a positive assertion.\n\n```ts\ntype suit =\n  | _\u003cexpect\u003cnumber, to.not.accept\u003c\"foo\"\u003e\u003e\u003e\n  | _\u003cexpect\u003cvoid, to.not.beDefined\u003e\u003e\n  // same as above\n  | _.fail\u003cexpect\u003cvoid, to.beDefined\u003e\u003e\n  | _.fail\u003cexpect\u003cnumber, to.accept\u003c\"foo\"\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `expect\u003c given, check \u003e`\n\nRuns a check against a given type and resolves in the checks boolean result: `true` if check passes and `false` if it fails.\n\n```ts\ntype result2 = expect\u003c1, to.beTruthy\u003e; // result1 is of type `true`\ntype result1 = expect\u003c0, to.beTruthy\u003e; // result1 is of type `false`\n\ntype suit =\n  | _\u003cresult2\u003e // passes\n  | _\u003cresult1\u003e // fails\n  // same as above\n  | _\u003cexpect\u003c1, to.beTruthy\u003e\u003e // passes\n  | _\u003cexpect\u003c0, to.beTruthy\u003e\u003e; // fails\n```\n\n[↥ To the listing](#api)\n\n## # `expectReturnOf\u003c given, check \u003e`\n\nExpects given to be a function and runs the check on its return value. Shortcut for `expect\u003cReturnType\u003cgiven\u003e, check\u003e`\n\n```ts\ntype suit =\n  | _\u003cexpectReturnOf\u003c() =\u003e string, to.accept\u003c\"foo\"\u003e\u003e\u003e\n  // same as above\n  | _\u003cexpect\u003cReturnType\u003c() =\u003e string\u003e, to.accept\u003c\"foo\"\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `expectParametersOf\u003c given, check \u003e`\n\nExpects given to be a function and runs the check on its parameters type. Shortcut for `expect\u003cParameters\u003cgiven\u003e, check\u003e`\n\n```ts\ntype suit =\n  | _\u003cexpectParametersOf\u003c(a: string, b?: number) =\u003e string, to.accept\u003c[string]\u003e\u003e\u003e\n  | _\u003cexpectParametersOf\u003c(a: string, b?: number) =\u003e string, to.accept\u003c[string, number]\u003e\u003e\u003e\n  | _\u003cexpectParametersOf\u003c(a: string, b?: number) =\u003e string, to.accept\u003c[string, undefined]\u003e\u003e\u003e\n  // same as above\n  | _\u003cexpect\u003cParameters\u003c(a: string, b?: number) =\u003e string\u003e, to.accept\u003c[string]\u003e\u003e\u003e\n  | _\u003cexpect\u003cParameters\u003c(a: string, b?: number) =\u003e string\u003e, to.accept\u003c[string, number]\u003e\u003e\u003e\n  | _\u003cexpect\u003cParameters\u003c(a: string, b?: number) =\u003e string\u003e, to.accept\u003c[string, undefined]\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `expectKeysOf\u003c given, check \u003e`\n\nExpects given to be an object and runs the check on its keys. Shortcut for `expect\u003ckeyof given, check\u003e`\n\n```ts\ntype suit =\n  | _\u003cexpectKeysOf\u003c{ a: string; b?: number }, to.be\u003c\"a\" | \"b\"\u003e\u003e\u003e\n  // same as above\n  | _\u003cexpect\u003ckeyof { a: string; b?: number }, to.be\u003c\"a\" | \"b\"\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `expectValuesOf\u003c given, check \u003e`\n\nExpects given to be an object or an array or a tuple and runs the check on its value types. Shortcut for `expect\u003cgiven[keyof given], check\u003e`\n\n```ts\ntype MyObject = { a: string; b?: number };\ntype MyArray = Array\u003cboolean\u003e;\ntype MyTuple = [index: number, value: string];\n\ntype suit =\n  | _\u003cexpectValuesOf\u003cMyObject, to.be\u003cstring | number | undefined\u003e\u003e\u003e\n  | _\u003cexpectValuesOf\u003cMyArray, to.accept\u003ctrue\u003e\u003e\u003e\n  | _\u003cexpectValuesOf\u003cMyTuple, to.accept\u003cnumber | string\u003e\u003e\u003e\n  // same as above\n  | _\u003cexpect\u003cMyObject[keyof MyObject], to.be\u003cstring | number | undefined\u003e\u003e\u003e\n  | _\u003cexpect\u003cMyArray[number], to.accept\u003ctrue\u003e\u003e\u003e\n  | _\u003cexpect\u003cMyTuple[number], to.accept\u003cnumber | string\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `_.falsy`\n\nA union of base and literal types that evaluates as false in JS. This does not include `NaN` since it's type is `number`.\n\n```ts\nexport type falsy = false | \"\" | 0 | 0n | null | undefined | void;\n```\n\n[↥ To the listing](#api)\n\n## # `_.primitive`\n\nA union of all the base types that are considered primitive types in JavaScript. Primitive means has no internal structure, thus can't be accessed inside. Even though `null` is technically of an `object` type it does not allow you to use a property accessor `.` to get it's, or it's prototypes content thus counting as a primitive value.\n\n```ts\nexport type primitive = string | number | bigint | boolean | symbol | null | undefined;\n```\n\n[↥ To the listing](#api)\n\n## # `_.nullish`\n\nA union of all the base types that are considered nullish, meaning can accept null or undefined.\n\n```ts\nexport type nullish = null | undefined | void;\n```\n\n[↥ To the listing](#api)\n\n## # `to.equalTo\u003c expected \u003e`\n\nGiven type should strictly equal to expected one. Both types should be assignable to each other.\n\n```ts\ntype MyType = number;\n\ntype suit =\n  | _\u003cexpect\u003cMyType, to.equalTo\u003cnumber\u003e\u003e\u003e\n  | _\u003cexpect\u003cMyType, to.not.equalTo\u003c1\u003e\u003e\u003e\n  | _\u003cexpect\u003cMyType, to.not.equalTo\u003cstring\u003e\u003e\u003e\n  | _\u003cexpect\u003cMyType, to.not.equalTo\u003c\"1\"\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.be\u003c expected \u003e`\n\nGiven type should strictly equal to expected one. Both types should be assignable to each other. Alias for [`to.equalTo\u003c expected \u003e`](#-toequalto-expected-)\n\n```ts\ntype MyType = number;\n\ntype suit =\n  | _\u003cexpect\u003cMyType, to.be\u003cnumber\u003e\u003e\u003e\n  | _\u003cexpect\u003cMyType, to.not.be\u003c1\u003e\u003e\u003e\n  | _\u003cexpect\u003cMyType, to.not.be\u003cstring\u003e\u003e\u003e\n  | _\u003cexpect\u003cMyType, to.not.be\u003c\"1\"\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.accept\u003c expected \u003e`\n\nExpected type should be assignable to a given one, bot not necessarily the other way around. Reverse of [`to.beAssignableTo\u003c expected \u003e`](#-tobeassignableto-expected-).\n\n```ts\ntype suit =\n  | _\u003cexpect\u003cnumber, to.accept\u003c1\u003e\u003e\u003e\n  | _\u003cexpect\u003c1, to.not.accept\u003cnumber\u003e\u003e\u003e\n  | _\u003cexpect\u003cnumber | string, to.accept\u003cnumber\u003e\u003e\u003e\n  | _\u003cexpect\u003cnumber, to.not.accept\u003cnumber | string\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.beAssignableTo\u003c expected \u003e`\n\nGiven type should be assignable to the expected one, bot not necessarily the other way around. Reverse of [`to.accept\u003c expected \u003e`](#-toaccept-expected-).\n\n```ts\ntype suit =\n  | _\u003cexpect\u003cnumber, to.accept\u003c1\u003e\u003e\u003e\n  | _\u003cexpect\u003c1, to.not.accept\u003cnumber\u003e\u003e\u003e\n  | _\u003cexpect\u003cnumber | string, to.accept\u003cnumber\u003e\u003e\u003e\n  | _\u003cexpect\u003cnumber, to.not.accept\u003cnumber | string\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.extend\u003c expected \u003e`\n\nExpected type is assignable to given but not the other way around. Means that given type is a superset of the expected one. Reverse of [`to.beExtendedBy\u003c expected \u003e`](#-tobeextendedby-expected-).\n\n```ts\ntype suit =\n  | _\u003cexpect\u003c1, to.extend\u003cnumber\u003e\u003e\u003e\n  | _\u003cexpect\u003c\"a\", to.extend\u003cstring\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e number, to.extend\u003cFunction\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: string; b: number }, to.extend\u003c{ a: string }\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.beExtendedBy\u003c expected \u003e`\n\nGiven type is assignable to expected but not the other way around. Means that expected type is a superset of the given one. Reverse of [`to.extend\u003c expected \u003e`](#-toextend-expected-).\n\n```ts\ntype suit =\n  | _\u003cexpect\u003cnumber, to.beExtendedBy\u003c1\u003e\u003e\u003e\n  | _\u003cexpect\u003cstring\u003e, to.beExtendedBy\u003c\"a\"\u003e\u003e\n  | _\u003cexpect\u003cFunction, to.beExtendedBy\u003c() =\u003e number\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: string }, to.beExtendedBy\u003c{ a: string; b: number }\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.beDefined`\n\nGiven type does not accept `undefined | void`\n\n```ts\ntype suit =\n  | _\u003cexpect\u003cnumber, to.beDefined\u003e\u003e\n  | _\u003cexpect\u003cstring, to.beDefined\u003e\u003e\n  | _\u003cexpect\u003cFunction, to.beDefined\u003e\u003e\n  | _\u003cexpect\u003cnull, to.beDefined\u003e\u003e\n  | _\u003cexpect\u003cundefined, to.not.beDefined\u003e\u003e\n  | _\u003cexpect\u003cvoid, to.not.beDefined\u003e\u003e\n  | _\u003cexpect\u003cnever, to.not.beDefined\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.beOptional`\n\nGiven type does can accept `undefined`. Reverse of [`to.beDefined`](#-tobedefined)\n\n```ts\ntype suit =\n  | _\u003cexpect\u003cundefined | number, to.beOptional\u003e\u003e\n  | _\u003cexpect\u003cundefined, to.beOptional\u003e\u003e\n  | _\u003cexpect\u003cvoid, to.beOptional\u003e\u003e\n  | _\u003cexpect\u003cnumber, to.not.beOptional\u003e\u003e\n  | _\u003cexpect\u003c\"\", to.not.beOptional\u003e\u003e\n  | _\u003cexpect\u003cfalse, to.not.beOptional\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.beNullish`\n\nGiven type can accept `null | undefined`\n\n```ts\ntype suit =\n  | _\u003cexpect\u003cnull, to.beNullish\u003e\u003e\n  | _\u003cexpect\u003cundefined, to.beNullish\u003e\u003e\n  | _\u003cexpect\u003cvoid, to.beNullish\u003e\u003e\n  | _\u003cexpect\u003cnumber, to.not.beNullish\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e void, to.not.beNullish\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.bePrimitive`\n\nGiven type can be assigned to one of the primitive types `string | number | bigint | boolean | symbol | null | undefined`\n\n```ts\ntype suit =\n  | _\u003cexpect\u003cnull, to.beNullish\u003e\u003e\n  | _\u003cexpect\u003cundefined, to.beNullish\u003e\u003e\n  | _\u003cexpect\u003cvoid, to.beNullish\u003e\u003e\n  | _\u003cexpect\u003cnumber, to.not.beNullish\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e void, to.not.beNullish\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.beLiteral`\n\nGiven type is a literal which means it extends one of these primitives: `number | string | boolean`\n\n```ts\ntype suit =\n  | _\u003cexpect\u003c1, to.beLiteral\u003e\u003e\n  | _\u003cexpect\u003c\"foo\", to.beLiteral\u003e\u003e\n  | _\u003cexpect\u003ctrue, to.beLiteral\u003e\u003e\n  | _\u003cexpect\u003cfalse, to.beLiteral\u003e\u003e\n  | _\u003cexpect\u003cstring, to.not.beLiteral\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.beNever`\n\nGiven type should resolve to `never`\n\n```ts\ntype suit =\n  | _\u003cexpect\u003cnever, to.beNever\u003e\u003e\n  | _\u003cexpect\u003c\"a\", to.not.beNever\u003e\u003e\n  | _\u003cexpect\u003cvoid, to.not.beNever\u003e\u003e\n  | _\u003cexpect\u003c_.primitive, to.not.beNever\u003e\u003e\n  | _.fail\u003cexpect\u003cnever, to.not.beNever\u003e\u003e; // types are weird, you never know :)\n```\n\n[↥ To the listing](#api)\n\n## # `to.beTruthy`\n\nGiven type can contain only truthy values, this means it's not compatible with falsy values and their supersets. Since `0` is falsy `number` can't be considered a truthy type since it can accept `0`.\n\n```ts\ntype suit =\n  | _\u003cexpect\u003c1, to.beTruthy\u003e\u003e\n  | _\u003cexpect\u003c\"foo\", to.beTruthy\u003e\u003e\n  | _\u003cexpect\u003ctrue, to.beTruthy\u003e\u003e\n  | _\u003cexpect\u003c{ a: any }, to.beTruthy\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e void, to.beTruthy\u003e\u003e\n  | _\u003cexpect\u003cfalse, to.not.beTruthy\u003e\u003e\n  | _\u003cexpect\u003cnumber, to.not.beTruthy\u003e\u003e\n  | _\u003cexpect\u003cboolean, to.not.beTruthy\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.beFalsy`\n\nGiven type can contain only a falsy value: `false | \"\" | 0 | 0n | null | undefined | void`. Type that can hold falsy and truthy value at the same time, like an optional field, can not be considered falsy.\n\n```ts\ntype suit =\n  | _\u003cexpect\u003cfalse, to.beFalsy\u003e\u003e\n  | _\u003cexpect\u003c0, to.beFalsy\u003e\u003e\n  | _\u003cexpect\u003cnull, to.beFalsy\u003e\u003e\n  | _\u003cexpect\u003c\"\", to.beFalsy\u003e\u003e\n  | _\u003cexpect\u003cboolean, to.not.beFalsy\u003e\u003e\n  | _\u003cexpect\u003cnumber | undefined, to.not.beFalsy\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.beInvocable`\n\nGiven type can be invoked like a function.\n\n```ts\ntype suit =\n  | _\u003cexpect\u003c() =\u003e any, to.beInvocable\u003e\u003e\n  | _\u003cexpect\u003cFunction, to.beInvocable\u003e\u003e\n  | _\u003cexpect\u003c{ (...args: any[]): void }, to.beInvocable\u003e\u003e\n  | _\u003cexpect\u003cnumber, to.not.beInvocable\u003e\u003e\n  | _\u003cexpect\u003cunknown, to.not.beInvocable\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.beNewable`\n\nGiven type is a constructor and can be instantiated with the `new` keyword.\n\n```ts\nclass EmptyClass {}\ntype suit =\n  | _\u003cexpect\u003ctypeof EmptyClass, to.beNewable\u003e\u003e\n  | _\u003cexpect\u003ctypeof RegExp, to.beNewable\u003e\u003e\n  | _\u003cexpect\u003cRegExp, to.not.beNewable\u003e\u003e\n  | _\u003cexpect\u003c{ new (arg: number): boolean }, to.beNewable\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e object, to.not.beNewable\u003e\u003e\n  | _\u003cexpect\u003c{ (arg: number): boolean }, to.not.beNewable\u003e\u003e\n  | _\u003cexpect\u003cobject, to.not.beNewable\u003e\u003e\n  | _\u003cexpect\u003cunknown, to.not.beNewable\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.startWith\u003c expected \u003e`\n\nGiven and expected types are strings and given is prefixed with expected.\n\n```ts\ntype suit =\n  | _\u003cexpect\u003c\"foobar\", to.startWith\u003c\"foo\"\u003e\u003e\u003e\n  | _\u003cexpect\u003c\"baz\", to.startWith\u003c\"\"\u003e\u003e\u003e\n  | _\u003cexpect\u003c\"foo\", to.not.startWith\u003c\"bar\"\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.endWith\u003c expected \u003e`\n\nGiven and expected types are strings and given is suffixed with expected.\n\n```ts\ntype suit =\n  | _\u003cexpect\u003c\"foobar\", to.endWith\u003c\"bar\"\u003e\u003e\u003e\n  | _\u003cexpect\u003c\"baz\", to.endWith\u003c\"\"\u003e\u003e\u003e\n  | _\u003cexpect\u003c\"foo\", to.not.endWith\u003c\"bar\"\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.contain\u003c expected \u003e`\n\nGiven and expected types are strings and expected is a substring of the given.\n\n```ts\ntype suit =\n  | _\u003cexpect\u003c\"foobar\", to.endWith\u003c\"bar\"\u003e\u003e\u003e\n  | _\u003cexpect\u003c\"baz\", to.endWith\u003c\"\"\u003e\u003e\u003e\n  | _\u003cexpect\u003c\"foo\", to.not.endWith\u003c\"bar\"\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.haveKeys\u003c expected \u003e`\n\nGiven is an object that should contain expected keys.\n\n```ts\ntype suit =\n  | _\u003cexpect\u003c{ a: number }, to.haveKeys\u003c\"a\"\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: number; b: string }, to.haveKeys\u003c\"a\"\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: number; b: string }, to.haveKeys\u003c\"b\"\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: number; b: string }, to.haveKeys\u003c\"a\" | \"b\"\u003e\u003e\u003e\n  | _\u003cexpect\u003cobject, to.not.haveKeys\u003c\"a\"\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.haveOnlyKeys\u003c expected \u003e`\n\nGiven is an object that should only contain expected keys.\n\n```ts\ntype suit =\n  | _\u003cexpect\u003c{ a: number }, to.haveOnlyKeys\u003c\"a\"\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: number; b: string }, to.not.haveOnlyKeys\u003c\"a\"\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: number; b: string }, to.not.haveOnlyKeys\u003c\"b\"\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: number; b: string }, to.haveOnlyKeys\u003c\"a\" | \"b\"\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.haveFieldsThatAccept\u003c expected \u003e`\n\nGiven is an object with fields that accept expected value types.\n\n```ts\ntype suit =\n  | _\u003cexpect\u003c{ a: number; b: string }, to.haveFieldsThatAccept\u003cnumber | string\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: number; b: string }, to.haveFieldsThatAccept\u003c\"foo\"\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: number; b: string }, to.haveFieldsThatAccept\u003c1\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: number; b: string }, to.haveFieldsThatAccept\u003c1 | \"foo\"\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: number; b?: string }, to.haveFieldsThatAccept\u003cundefined\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: number; b?: string }, to.not.haveFieldsThatAccept\u003cboolean\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: number; b?: string }, to.not.haveFieldsThatAccept\u003cnumber | string | boolean\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.haveFieldsThatAcceptOnly\u003c expected \u003e`\n\nGiven is an object with fields that accept only expected value types.\n\n```ts\ntype suit =\n  | _\u003cexpect\u003c{ a: number; b: string }, to.haveFieldsThatAcceptOnly\u003cnumber | string\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: number; b: string }, to.not.haveFieldsThatAcceptOnly\u003c\"foo\"\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: number; b: string }, to.not.haveFieldsThatAcceptOnly\u003c1\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: number; b: string }, to.not.haveFieldsThatAcceptOnly\u003c1 | \"foo\"\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: number; b?: string }, to.not.haveFieldsThatAcceptOnly\u003cundefined\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: number; b?: string }, to.not.haveFieldsThatAcceptOnly\u003cboolean\u003e\u003e\u003e\n  | _\u003cexpect\u003c{ a: number; b?: string }, to.not.haveFieldsThatAccept\u003cnumber | string | boolean\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.include\u003c expected \u003e`\n\nGiven is an array that can contain the expected type.\n\n```ts\ntype suit =\n  | _\u003cexpect\u003cArray\u003cnumber\u003e, to.include\u003cnumber\u003e\u003e\u003e\n  | _\u003cexpect\u003cArray\u003cnumber | string\u003e, to.include\u003cnumber\u003e\u003e\u003e\n  | _\u003cexpect\u003cnumber[], to.include\u003cnumber\u003e\u003e\u003e\n  | _\u003cexpect\u003c[number], to.include\u003cnumber\u003e\u003e\u003e\n  | _\u003cexpect\u003c[number, string], to.include\u003cnumber\u003e\u003e\u003e\n  | _\u003cexpect\u003c[number, string], to.not.include\u003cnumber | string | boolean\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.returnType\u003c expected \u003e`\n\nGiven is a function whose return type should be assignable to the expected type.\n\n```ts\ntype suit =\n  | _\u003cexpect\u003c() =\u003e number | string, to.returnType\u003cnumber\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e void, to.returnType\u003cvoid\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e void, to.returnType\u003cundefined\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e Promise\u003c\"a\"\u003e, to.returnType\u003cPromise\u003cany\u003e\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e number[], to.returnType\u003cArray\u003cnumber\u003e\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e number, to.not.return\u003cstring\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e 1, to.not.return\u003cnumber\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.returnTypeOnly\u003c expected \u003e`\n\nGiven is a function whose return type should strictly equal to the expected type, meaning they both should be assignable to each other.\n\n```ts\ntype suit =\n  | _\u003cexpect\u003c() =\u003e number | string, to.returnTypeOnly\u003cnumber | string\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e number | string, to.not.returnOnly\u003cnumber\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e void, to.returnTypeOnly\u003cvoid\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e number[], to.returnTypeOnly\u003cArray\u003cnumber\u003e\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e number, to.not.returnOnly\u003cstring\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e 1, to.not.returnOnly\u003cnumber\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.resolveTo\u003c expected \u003e`\n\nGiven is a function whose return type is a promise that resolves to the expected type.\n\n```ts\ntype suit =\n  | _\u003cexpect\u003c() =\u003e Promise\u003cvoid\u003e, to.resolveTo\u003cundefined\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e Promise\u003cnumber\u003e, to.resolveTo\u003cnumber\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e Promise\u003cnumber | string | boolean\u003e, to.resolveTo\u003cnumber | string\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e Promise\u003c1\u003e, to.not.resolveTo\u003cnumber\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e Promise\u003cnumber\u003e, to.not.resolveTo\u003cnumber | string\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e Promise\u003cPromise\u003cstring\u003e\u003e, to.not.resolveTo\u003cstring\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.resolveToOnly\u003c expected \u003e`\n\nGiven is a function whose return type is a promise that resolves exactly to the expected type, meaning they both should be assignable to each other.\n\n```ts\ntype suit =\n  | _\u003cexpect\u003c() =\u003e Promise\u003cvoid\u003e, to.resolveToOnly\u003cvoid\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e Promise\u003cnumber\u003e, to.resolveToOnly\u003cnumber\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e Promise\u003cvoid\u003e, to.not.resolveToOnly\u003cundefined\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e Promise\u003cnumber | string\u003e, to.not.resolveToOnly\u003cnumber\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e Promise\u003cnumber\u003e, to.not.resolveToOnly\u003cnumber | string\u003e\u003e\u003e\n  | _\u003cexpect\u003c() =\u003e Promise\u003cnumber\u003e, to.not.resolveToOnly\u003c1\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.acceptParameters\u003c expected \u003e`\n\nGiven is a function whose parameters can accept expected type.\n\n```ts\ntype suit =\n  | _\u003cexpect\u003c() =\u003e void, to.acceptParameters\u003c[]\u003e\u003e\u003e\n  | _\u003cexpect\u003c(a: string) =\u003e void, to.acceptParameters\u003c[string]\u003e\u003e\u003e\n  | _\u003cexpect\u003c(a: string | number) =\u003e void, to.acceptParameters\u003c[string]\u003e\u003e\u003e\n  | _\u003cexpect\u003c(a: string | number) =\u003e void, to.acceptParameters\u003c[string | number]\u003e\u003e\u003e\n  | _\u003cexpect\u003c(a: string, b: number) =\u003e void, to.acceptParameters\u003c[string, number]\u003e\u003e\u003e\n  | _\u003cexpect\u003c(a: \"a\") =\u003e void, to.not.acceptParameters\u003c[string]\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n\n## # `to.acceptOnlyParameters\u003c expected \u003e`\n\nGiven is a function whose parameters can accept only expected type. Pay attention to optional parameters! Function with optional parameters resolves its parameters to a tuple with optional elements, and they are not strictly compatible with similar const arrays.\n\n```ts\ntype suit =\n  | _\u003cexpect\u003c() =\u003e void, to.acceptOnlyParameters\u003c[]\u003e\u003e\u003e\n  | _\u003cexpect\u003c(a: string) =\u003e void, to.acceptOnlyParameters\u003c[string]\u003e\u003e\u003e\n  | _\u003cexpect\u003c(a: string | number) =\u003e void, to.not.acceptOnlyParameters\u003c[string]\u003e\u003e\u003e;\n\ntype Fn = (a: string, b?: number) =\u003e void; // parameters resolve to `[a: string, b?: number | undefined]`\ntype suit2 =\n  // Pay attention! This test fails:\n  | _.fail\u003cexpect\u003cFn, to.acceptOnlyParameters\u003c[string, number | undefined]\u003e\u003e\u003e\n  // This one passes:\n  | _.pass\u003cexpect\u003cFn, to.acceptOnlyParameters\u003c[a: string, b?: number | undefined]\u003e\u003e\u003e;\n```\n\n[↥ To the listing](#api)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn1kk%2Ftyped-well","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fn1kk%2Ftyped-well","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn1kk%2Ftyped-well/lists"}