{"id":13727335,"url":"https://github.com/DefinitelyTyped/dts-critic","last_synced_at":"2025-05-07T22:31:07.635Z","repository":{"id":44160734,"uuid":"169495340","full_name":"DefinitelyTyped/dts-critic","owner":"DefinitelyTyped","description":"Checks a new dts against the JavaScript sources and tells you what problems it has","archived":true,"fork":false,"pushed_at":"2022-02-11T15:41:55.000Z","size":1043,"stargazers_count":45,"open_issues_count":14,"forks_count":13,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-17T12:29:21.957Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DefinitelyTyped.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-02-06T23:55:45.000Z","updated_at":"2024-09-11T08:20:24.000Z","dependencies_parsed_at":"2022-09-04T00:01:18.313Z","dependency_job_id":null,"html_url":"https://github.com/DefinitelyTyped/dts-critic","commit_stats":null,"previous_names":["sandersn/dts-critic"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefinitelyTyped%2Fdts-critic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefinitelyTyped%2Fdts-critic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefinitelyTyped%2Fdts-critic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefinitelyTyped%2Fdts-critic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DefinitelyTyped","download_url":"https://codeload.github.com/DefinitelyTyped/dts-critic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252965381,"owners_count":21832881,"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-08-03T01:03:50.361Z","updated_at":"2025-05-07T22:31:07.344Z","avatar_url":"https://github.com/DefinitelyTyped.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"This repo has moved: dts-critic is now part of DefinitelyTyped-tools\n\nIt is not intended to be used on its own, but as part of the `@definitelytyped` set of packages.\nThe source code has moved to https://github.com/microsoft/DefinitelyTyped-tools\nThe new package name is `@definitelytyped/dts-critic`.\nIf there is future demand for standalone usage, this repo should wrap `@definitelytyped/dts-critic` in a command-line interface.\n\nChecks a new dts against the Javascript sources and tells you what\nproblems it has.\n\n# Usage\n\nBuild the program:\n```sh\n$ npm run build\n```\n\nRun the program using node:\n```sh\n$ node dist/index.js --dts=path-to-d.ts [--js=path-to-source] [--mode=mode] [--debug]\n```\n\nIf the d.ts path is to a file named `index.d.ts`, the name of the directory\nwill be used as the package name instead. For example\n`~/dt/types/jquery/index.d.ts` will use `jquery` as the name.\n\n`path-to-source` is optional; if you leave it off, the code will\ncheck npm for a package with the same name as the d.ts.\n\n## Mode\n\nYou can run dts-critic in different modes that affect which checks will be performed:\n1. `name-only`: dts-critic will check your package name and [DefinitelyTyped header]\n(https://github.com/Microsoft/definitelytyped-header-parser) (if present) against npm packages.\nFor example, if your declaration is for an npm package called 'cool-js-package', it will check if a\npackage named 'cool-js-package' actually exists in npm.\n\n2. `code`: in addition to the checks performed in `name-only` mode, dts-critic will check if your\ndeclaration exports match the source JavaScript module exports.\nFor example, if your declaration has a default export, it will check if the JavaScript module also\nhas a default export.\n\n# Current checks\n\n## Npm declaration\nIf your declaration is for an npm package:\n\n1. An npm package with the same name of your declaration's package must exist.\n2. If your declaration has a [Definitely Typed header](https://github.com/Microsoft/definitelytyped-header-parser)\nand the header specifies a target version, the npm package must have\na matching version.\n3. If you are running under `code` mode, your declaration must also match the source JavaScript module.\n\n## Non-npm declaration\n\u003c!-- 2. If no local path to source is provided, an npm package with the\nsame name as the d.ts must exist. --\u003e\nIf your declaration is for a non-npm package (in other words, if your declaration has a\n[Definitely Typed header](https://github.com/Microsoft/definitelytyped-header-parser) *and*\nthe header specifies that the declaration file is for a non-npm package):\n\n1. An npm package with the same name of your declaration's package **cannot** exist.\n3. If you are running under `code` mode *and* a path to the JavaScript source file was provided, your\ndeclaration must also match the source JavaScript module.\n\n# Planned work\n\n1. Make sure your module structure fits the source.\n2. Make sure your exported symbols match the source.\n3. Make sure your types match the source types???\n6. Download source based on npm homepage (if it is github).\n\nNote that for real use on Definitely Typed, a lot of these checks need to be pretty loose.\n\n# Also\n\n```sh\n$ node dist/dt.js\n```\n\nWill run dts-critic on every directory inside `../DefinitelyTyped` and\nprint errors.\n\n# Contributing\n\n## Testing\n\nThe tests use the [Jest](https://jestjs.io/) framework. To build and execute the tests, run:\n\n```sh\n$ npm run test\n```\n\nThis will build the program and run jest.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDefinitelyTyped%2Fdts-critic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDefinitelyTyped%2Fdts-critic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDefinitelyTyped%2Fdts-critic/lists"}