{"id":16528349,"url":"https://github.com/danvk/typings-checker","last_synced_at":"2025-09-12T19:31:33.454Z","repository":{"id":48598829,"uuid":"78892318","full_name":"danvk/typings-checker","owner":"danvk","description":"Positive and negative assertions about TypeScript types and errors","archived":false,"fork":false,"pushed_at":"2021-05-10T16:01:13.000Z","size":136,"stargazers_count":49,"open_issues_count":11,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-27T15:15:35.723Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danvk.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}},"created_at":"2017-01-13T22:39:17.000Z","updated_at":"2024-01-21T17:16:10.000Z","dependencies_parsed_at":"2022-09-07T17:26:06.208Z","dependency_job_id":null,"html_url":"https://github.com/danvk/typings-checker","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvk%2Ftypings-checker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvk%2Ftypings-checker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvk%2Ftypings-checker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvk%2Ftypings-checker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danvk","download_url":"https://codeload.github.com/danvk/typings-checker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232779406,"owners_count":18575363,"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":[],"created_at":"2024-10-11T17:39:49.076Z","updated_at":"2025-01-06T19:52:58.282Z","avatar_url":"https://github.com/danvk.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# This is not maintained! Check out [dtslint](https://github.com/microsoft/dtslint) and [tsd](https://github.com/SamVerschueren/tsd).\n\n----\n\n# typings-checker [![CircleCI](https://circleci.com/gh/danvk/typings-checker.svg?style=svg)](https://circleci.com/gh/danvk/typings-checker)\n\nThe [tests in DefinitelyTyped][1] verify that correct code type checks.\nBut this is an easy bar to meet: giving a module an `any` type is sufficient to make\nits tests type check.\n\nIt's just as important that _incorrect_ code _not_ typecheck. There isn't any way to\ntest for this in DT right now. This repo provides a proof of concept for how this could\nbe added. It's modeleled after the way [FlowTyped][] handles things.\n\nHere's what a test for `_.find` might look like:\n\n```ts\n_.find([1, 2, 3], x =\u003e x * 1 == 3);  // (this is just expected to type check)\n// $ExpectError Operator '==' cannot be applied to types 'number' and 'string'.\n_.find([1, 2, 3], x =\u003e x == 'a');\n// $ExpectType number\n_.find([1, 2, 3], 1);\n// $ExpectError Property 'y' does not exist on type '{ x: number; }'.\n_.find([{x:1}, {x:2}, {x:3}], v =\u003e v.y == 3);\n// $ExpectType { x: number; }\n_.find([{x:1}, {x:2}, {x:3}], v =\u003e v.x == 3);\n```\n\nCode is expected to type check unless an `$ExpectError` directive is used. In this case, an error is required (lack of an error from TypeScript is a test failure).\n\nAn `$ExpectType` directive tests the type of the expression on the next line. This prevents unexpected `any` or `{}` types from creeping in.\n\n## Usage\n\n    npm install -g typings-checker\n    typings-checker --project tsconfig.json your-test.ts your-second-test.ts\n    \n## Options\n\n    --project\n      Path to the relevant tsconfig.json file\n    \n    --allow-expect-error\n      Enables $ExpectError assertions. These can help pin down behavior but they\n      also prevent tsc from running over your assertions. Disabled by default.\n\n## Development\n\n```\n$ npm install -g yarn ts-node\n$ yarn\n$ ts-node src/index.ts sample.ts\nSuccesses: 6\nFailures: 0\n```\n\n[1]: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0f756aca1642eaf49998565788caf18ef635271e/underscore/underscore-tests.ts\n[FlowTyped]: https://github.com/flowtype/flow-typed/blob/a880b140e32d9d562abbe3924b2c10a583b3a6e1/definitions/npm/underscore_v1.x.x/test_underscore-v1.js\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanvk%2Ftypings-checker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanvk%2Ftypings-checker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanvk%2Ftypings-checker/lists"}