{"id":14967471,"url":"https://github.com/mysticatea/type-tester","last_synced_at":"2025-10-25T20:31:18.130Z","repository":{"id":57383252,"uuid":"166772452","full_name":"mysticatea/type-tester","owner":"mysticatea","description":"A tester to check expected type errors","archived":false,"fork":false,"pushed_at":"2019-01-21T12:46:14.000Z","size":17,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-31T10:23:57.160Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/mysticatea.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":"2019-01-21T08:02:32.000Z","updated_at":"2019-07-06T18:19:29.000Z","dependencies_parsed_at":"2022-09-14T00:00:26.258Z","dependency_job_id":null,"html_url":"https://github.com/mysticatea/type-tester","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mysticatea%2Ftype-tester","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mysticatea%2Ftype-tester/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mysticatea%2Ftype-tester/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mysticatea%2Ftype-tester/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mysticatea","download_url":"https://codeload.github.com/mysticatea/type-tester/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238207641,"owners_count":19434095,"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-09-24T13:38:06.468Z","updated_at":"2025-10-25T20:31:13.092Z","avatar_url":"https://github.com/mysticatea.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# type-tester\n\n[![npm version](https://img.shields.io/npm/v/type-tester.svg)](https://www.npmjs.com/package/type-tester)\n[![Downloads/month](https://img.shields.io/npm/dm/type-tester.svg)](http://www.npmtrends.com/type-tester)\n[![Build Status](https://travis-ci.com/mysticatea/type-tester.svg?branch=master)](https://travis-ci.com/mysticatea/type-tester)\n[![Coverage Status](https://codecov.io/gh/mysticatea/type-tester/branch/master/graph/badge.svg)](https://codecov.io/gh/mysticatea/type-tester)\n[![Dependency Status](https://david-dm.org/mysticatea/type-tester.svg)](https://david-dm.org/mysticatea/type-tester)\n\nA tester to check expected type errors.\n\n## 🏁 Goal\n\nThis package provides utility to verify that the type you have written stricter reports expected type errors, for TypeScript.\n\n## 💿 Installation\n\nUse [npm] or a compatible tool to install this package.\n\n```\nnpm install type-tester typescript\n```\n\n- Requires Node.js `\u003e=6.0.0`.\n\n## 📖 Usage\n\n1. Write fixture files.\n2. Write test files.\n3. Run test files with test runner such as [mocha].\n\n### 1. Write fixture files.\n\nThe fixture file should include the situation of type error.\nYou must add directive comments such as `// @expected 2345` for each line of expected errors.\nThe number is the error code of TypeScript.\n\nFor example: [test/fixtures/event-target-shim/fixture.ts](test/fixtures/event-target-shim/fixture.ts)\n\n### 2. Write test files.\n\nThe test file should execute `TypeTester#verify()` method with the path to the fixture files and compiler options.\n\nFor example: [test/example.ts](test/example.ts)\n\n### 3. Run test files with test runner such as [mocha].\n\nBecause the `TypeTester#verify()` method defines test cases with `describe` / `it` global functions, you must run it with test runners.\n\nFor example:\n\n```\nmocha test/example.ts --require ts-node/register\n\n  this test runs the type tester merely.\n    fixture.ts\n      √ should have an error TS2345 at L98.\n      √ should have an error TS2345 at L101.\n      √ should have an error TS7006 at L102.\n      √ should have an error TS2345 at L105.\n      √ should have an error TS7006 at L106.\n      √ should have an error TS2322 at L108.\n      √ should have an error TS2322 at L109.\n      √ should have an error TS2345 at L152.\n\n  8 passing (11ms)\n```\n\n## 📚 API References\n\n### `TypeTester` class\n\nThe class to verify expected type errors.\n\n### `constructor(ts: typeof import(\"typescript\"), options: TypeTester.Options)`\n\n#### Parameters\n\nName | Description\n:----|:-----------\n`ts` | API to use type checking.\n`options.describe` | Optional. Function to declare test suites. Use `global.describe` by default.\n`options.it` | Optional. Function to declare test cases. Use `global.it` by default.\n\n### `tester.verify(fixtureFiles: ReadonlyArray\u003cstring\u003e, compilerOptions: ts.CompilerOptions): void`\n\nVerify the given fixture files.\n\n#### Parameters\n\nName | Description\n:----|:-----------\n`fixtureFiles` | Path to fixture files.\n`compilerOptions` | Compiler options to verify the fixture files.\n\n## 📰 Release notes\n\n- https://github.com/mysticatea/type-tester/releases\n\n## ❤️ Contributing\n\nContribution is welcome!\n\nPlease use GitHub issues and pull requests.\n\n### Development tools\n\n- `npm run build` generates files into `dist` directory.\n- `npm run clean` removes temporary files.\n- `npm run coverage` opens the coverage report the last `npm test` command generated.\n- `npm run lint` runs ESLint.\n- `npm test` runs tests.\n- `npm run watch` runs tests on each file edits.\n\n[mocha]: https://mochajs.org/\n[npm]: https://www.npmjs.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmysticatea%2Ftype-tester","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmysticatea%2Ftype-tester","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmysticatea%2Ftype-tester/lists"}