{"id":17929179,"url":"https://github.com/skarab42/tssert","last_synced_at":"2025-04-03T11:15:37.061Z","repository":{"id":62355050,"uuid":"510331128","full_name":"skarab42/tssert","owner":"skarab42","description":"🔥 Micro TypeScript assertion (test) library.","archived":false,"fork":false,"pushed_at":"2023-07-20T17:51:58.000Z","size":101,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-09T02:46:10.957Z","etag":null,"topics":["assert","assertion","test","testing","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@skarab/tssert","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skarab42.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"skarab42","custom":"http://paypal.me/skarab"}},"created_at":"2022-07-04T11:27:16.000Z","updated_at":"2022-07-04T12:20:01.000Z","dependencies_parsed_at":"2024-12-16T07:42:22.145Z","dependency_job_id":"60033e9b-834b-490e-976f-ee5d49dcdea0","html_url":"https://github.com/skarab42/tssert","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"0365398f122294b7c9e2ef4704fc571c5ba87d05"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skarab42%2Ftssert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skarab42%2Ftssert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skarab42%2Ftssert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skarab42%2Ftssert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skarab42","download_url":"https://codeload.github.com/skarab42/tssert/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246989753,"owners_count":20865331,"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":["assert","assertion","test","testing","typescript"],"created_at":"2024-10-28T21:07:56.517Z","updated_at":"2025-04-03T11:15:37.044Z","avatar_url":"https://github.com/skarab42.png","language":"TypeScript","funding_links":["https://github.com/sponsors/skarab42","http://paypal.me/skarab"],"categories":[],"sub_categories":[],"readme":"# @skarab/tssert\n\nMicro TypeScript assertion (test) library.\n\n\u003e Add your assertions to your usual test suite and run `tsc --noEmit`, enjoy!\n\n📌 Please note that this library does not perform any check at runtime, but only at compile time (or in your IDE).\n\n# Why ?\n\nAn attempt to reduce the [verbosity](https://github.com/colinhacks/zod/blob/51e93e7dd30b161d55e2f17d0907ecdd2f526c60/src/__tests__/default.test.ts#L51-L56) of type testing.\n\n# Install\n\n```bash\npnpm add @skarab/tssert typescript\n```\n\n# Usages\n\n## With a full description of the error\n\n```ts\nimport { expectType } from '@skarab/tssert';\n\nexpectType\u003cboolean\u003e().toAccept(true);\nexpectType\u003ctrue\u003e().toAccept(false); // ts-error with description\n```\n\n## Without error description, but stricter and more flexible\n\n```ts\nexpectType('Hello').toExtend('42').toBe(true);\nexpectType\u003cstring\u003e().toExtend('42').toBe(true);\nexpectType('Hello').toExtend\u003cstring\u003e().toBe(true);\nexpectType\u003cstring\u003e().toExtend\u003cstring\u003e().toBe(true);\n\nexpectType\u003cboolean\u003e().toExtend\u003ctrue\u003e().toBe(true); // ts-error\nexpectType\u003ctrue\u003e().toExtend\u003cboolean\u003e().toBe(true);\n```\n\n\u003e When you move the mouse over `toAccept`, `toExtend` and `toEqual` you can see the expected and received values.\n\u003e\n\u003e ![Sans titre](https://user-images.githubusercontent.com/62928763/177138437-c9b271dd-e99f-41b7-9415-146cd2981076.png)\n\n# API\n\n## toExtend()\n\n```ts\ninterface TypeA {\n\ta: 42;\n\tb: string | number;\n}\n\ninterface TypeB {\n\ta: 42;\n\tb: number;\n}\n\nexpectType\u003cTypeB\u003e().toExtend\u003cTypeA\u003e().toBe(true);\nexpectType\u003cTypeA\u003e().toExtend\u003cTypeB\u003e().toBe(true); // ts-error\n```\n\n## toEqual()\n\n```ts\nexpectType\u003cTypeA\u003e().toEqual\u003cTypeA\u003e().toBe(true);\nexpectType\u003cTypeA\u003e().toEqual\u003cTypeB\u003e().toBe(true); // ts-error\nexpectType\u003cTypeB\u003e().toEqual\u003cTypeA\u003e().toBe(true); // ts-error\n```\n\n## Types ...\n\n```ts\nimport type { ExpectExtend, ExpectEqual } from '@skarab/tssert';\n\ntype A = ExpectExtend\u003cTypeB, TypeA\u003e; // true\ntype B = ExpectEqual\u003cTypeA, TypeB\u003e; // false\n```\n\n# TypeScript ~~god~~ strict mode\n\nIt is strongly recommended to activate the [strict](https://www.typescriptlang.org/tsconfig#strict) mode of TypeScript which will activate all checking behaviours that results in stronger guarantees of the program's correctness.\n\n# Contributing 💜\n\nSee [CONTRIBUTING.md](https://github.com/skarab42/tssert/blob/main/CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskarab42%2Ftssert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskarab42%2Ftssert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskarab42%2Ftssert/lists"}