{"id":18917492,"url":"https://github.com/aikoven/assert-never","last_synced_at":"2025-05-16T06:06:55.212Z","repository":{"id":57185027,"uuid":"86331617","full_name":"aikoven/assert-never","owner":"aikoven","description":"Helper function for exhaustive checks of discriminated unions in TypeScript","archived":false,"fork":false,"pushed_at":"2024-12-17T10:12:22.000Z","size":169,"stargazers_count":45,"open_issues_count":1,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-08T16:05:03.231Z","etag":null,"topics":["assert","discriminated-unions","never","typescript"],"latest_commit_sha":null,"homepage":"","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/aikoven.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2017-03-27T12:17:24.000Z","updated_at":"2024-12-17T10:11:13.000Z","dependencies_parsed_at":"2025-01-12T16:03:13.715Z","dependency_job_id":"373df10e-fafd-4491-aac4-f0ba79afdee2","html_url":"https://github.com/aikoven/assert-never","commit_stats":{"total_commits":18,"total_committers":6,"mean_commits":3.0,"dds":0.5555555555555556,"last_synced_commit":"975f04fdc03a6861b7ca6f9875000fc681298a12"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aikoven%2Fassert-never","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aikoven%2Fassert-never/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aikoven%2Fassert-never/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aikoven%2Fassert-never/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aikoven","download_url":"https://codeload.github.com/aikoven/assert-never/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254478190,"owners_count":22077676,"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","discriminated-unions","never","typescript"],"created_at":"2024-11-08T10:26:30.396Z","updated_at":"2025-05-16T06:06:50.202Z","avatar_url":"https://github.com/aikoven.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Assert Never [![npm version][npm-image]][npm-url]\n\nHelper function for [exhaustive checks][exhaustive-checks] of discriminated\nunions in TypeScript.\n\n## Installation\n\n```\nnpm install --save assert-never\n```\n\n## Usage\n\n```ts\nimport {assertNever} from \"assert-never\";\n\ntype A = {type: 'a'};\ntype B = {type: 'b'};\ntype Union = A | B;\n\nfunction doSomething(arg: Union) {\n  if (arg.type === 'a') {\n    return something;\n  }\n\n  if (arg.type === 'b') {\n    return somethingElse;\n  }\n\n  // TS will error if there are other types in the union\n  // Will throw an Error when called at runtime. Use `assertNever(arg, true)`\n  // instead to fail silently.\n  return assertNever(arg);\n}\n```\n\n[npm-image]: https://badge.fury.io/js/assert-never.svg\n[npm-url]: https://badge.fury.io/js/assert-never\n[exhaustive-checks]: https://basarat.gitbook.io/typescript/type-system/discriminated-unions#exhaustive-checks\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faikoven%2Fassert-never","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faikoven%2Fassert-never","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faikoven%2Fassert-never/lists"}