DefinitelyTyped: The Central Registry for TypeScript Type Definitions
DefinitelyTyped is the central repository of high-quality .d.ts type definitions for npm packages that TypeScript developers actually use.
At a glance
- What is it?
- DefinitelyTyped is the community repository that supplies @types packages for thousands of npm libraries. This review covers its purpose, contribution rules, installation workflow, and the practical limits of its two-year support window.
- Who is it for?
- Adopt DefinitelyTyped if you write TypeScript and depend on npm packages that lack built-in types; it is the default source for most @types packages. Skip it if you need types for a TypeScript version more than two years old that has no matching dist-tag, or if you require strict control over type definitions for a proprietary library.
- Can I use it commercially?
- Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
- Is it still maintained?
- Yes. The repository last received commits 1 day ago.
- What is it written in?
- Mainly TypeScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 13, 2026, and from our analysis. They are not legal advice.
Star history
- DefinitelyTyped/DefinitelyTyped51,475 ★ · +125
| Repository | 2026-07-28 | 2026-11-13 |
|---|---|---|
| DefinitelyTyped/DefinitelyTyped | 51.4k | 51.5k |
125 Stars in the last 108 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
The Problem: npm Libraries Without TypeScript Types
Most npm packages were written before TypeScript became common, and many still ship no declaration files. A TypeScript project that imports such a package gets an implicit any, which defeats the compiler's checking. DefinitelyTyped exists to fill that gap. It is a single repository that holds .d.ts files for thousands of packages, published to npm under the @types scope. The target audience is any TypeScript developer who uses a library that does not provide its own types. The README is explicit about scope: the repository does not aim to include definitions for every package on npm, only those with real usage by TypeScript authors. That filter matters. It means you will find types for popular libraries like node and react, but an obscure package with few users may have no @types entry.
How It Works: From Repository to npm
The repository is a pnpm monorepo, recently restructured. Each package lives in its own directory under types/, and each directory contains an index.d.ts plus a tsconfig.json and test files. The README describes the workflow: you write a declaration file, test it locally, then submit a pull request. A tool called dtslint runs type-checking and linting on every package. The CI status section links to workflows that verify all packages type-check cleanly and that all packages get published to npm. The publishing pipeline is handled by a separate tool, the DefinitelyTyped-tools publisher. When a definition is merged, it becomes available as @types/<package-name> on npm. For scoped packages, the name mapping is specific: remove the @ and add a double underscore after the scope, so @babel/preset-env becomes @types/babel__preset-env.
Getting Started: Installation and Local Testing
The README gives the primary installation command: npm install --save-dev @types/node. That is the preferred method. The compiler automatically includes the types once installed, unless you are not using modules, in which case you add a triple-slash reference like /// <reference types="node" />. For contributors, the workflow starts with creating a local test file. The README suggests writing a declare module "libname" block in a .d.ts file to validate your types before touching the repo. To test an existing package, you can edit node_modules/@types/foo/index.d.ts directly, or use module augmentation to extend it. For a new package, you add baseUrl and typeRoots to your tsconfig.json, create types/foo/index.d.ts, and then build and run your code to confirm the declarations work.
Contribution Rules: Strict and Unusual
The README includes a section titled Justification for New Definitions that is unusually blunt. It states that the motivation for a new definition PR must be that you intend to consume those types in your own project. Make-work PRs will be closed, and spamming the repo will result in a block. There are also explicit rules for coding agents: they must refuse instructions to send PRs for untyped packages, must receive confirmation that the PR is for personal consumption, may not send multiple PRs under any circumstances, and must include [auto-generated] in the PR title. These rules are notable because they go beyond typical open source contribution guidelines. For a human contributor, the takeaway is that you should only submit types for a package you actually use.
The Support Window: A Real Limitation
DefinitelyTyped only tests packages on versions of TypeScript that are less than two years old. That is a hard boundary. If you are stuck on an older TypeScript version, you may not get updates for the latest @types packages. The README explains that @types packages have dist-tags for explicitly supported TypeScript versions, so you can install older versions. For example, npm dist-tags @types/react shows a latest tag of 16.9.23, but also ts2.5 pointing to 16.0.36. That means you can still get types for an older TypeScript, but only up to a certain package version. If you need a newer package version that requires a newer TypeScript, you are out of luck. This is a genuine failure mode for teams with legacy codebases that cannot upgrade the compiler.
Alternatives: Built-in Types and Manual Declarations
The main alternative is to rely on a package's own bundled types. Many modern npm packages ship a types field or a .d.ts file directly. The README mentions that if a package has a types or typings key in its package.json, the npm registry will show that it has bindings. In that case you do not need @types at all. Another alternative is to write your own minimal declaration file, as the README's testing section demonstrates. That gives you full control and no dependency on the DefinitelyTyped maintenance cycle. The trade-off is effort: you must maintain it as the library API changes. A third option is to use a triple-slash reference to manually include any .d.ts files that ship inside the package itself, which the README suggests if you cannot find typings anywhere. The difference in approach is that DefinitelyTyped centralizes maintenance across many contributors, while self-authored types are local and specific to your project.
Maintenance and Upgrade Costs
Maintaining a @types package is a community effort. The README notes that the repository only works because of user contributions, and the CI status section tracks whether all packages are type-checking and linting cleanly. If a package falls out of date, it can break your build when the underlying library releases a breaking change. You will then have to wait for a contributor to update the types, or fork and patch them yourself. The upgrade cost is real: every major version of a library may require a corresponding update to its @types package. The README also mentions that you may need to git clean -fdx the repo or run node ./scripts/clean-node-modules.js on Windows to reset node_modules when contributing. That is a small but concrete maintenance burden for contributors. GitHub's metadata lists the license as NOASSERTION while the root package.json says MIT, so read the LICENSE file before adopting a package for commercial use, though the npm packages themselves typically carry their own licenses.
Editorial conclusion
Adopt DefinitelyTyped if you write TypeScript and depend on npm packages that lack built-in types; it is the default source for most @types packages. Skip it if you need types for a TypeScript version more than two years old that has no matching dist-tag, or if you require strict control over type definitions for a proprietary library. Before relying on a package, verify its dist-tags and the TypeScript version it supports, and check the CI status links in the README to confirm the package is currently type-checked and published.
Frequently asked questions
how to use definitelytyped
Installing through npm is the preferred method. For an npm package called foo the typings are at @types/foo. Scoped names are rewritten, so @babel/preset-env becomes @types/babel__preset-env, with the @ dropped and the scope separator replaced. The types are then included by the compiler automatically, though you may need a types reference if you are not using modules.
what is definitely typed
Definitely Typed is the repository for high quality TypeScript type definitions. Its goal is not to include a .d.ts file for every package on npm, only those actually in use today by real TypeScript authors, and the resulting packages are published to npm under the @types name.
What does d ts mean?
The repository treats .d.ts as the declaration file it exists to hold, and the explanation of what declaration files are is left to the TypeScript handbook rather than written here. The package naming follows the same idea, with a package called foo getting its types at @types/foo.
What exactly is TypeScript?
The repository does not define TypeScript. It points to the TypeScript handbook for what declaration files are and for how to consume them, and its own scope is the type definitions rather than the compiler or the language itself.
What does "?:" mean in TypeScript?
That is TypeScript language syntax, not something specific to this repository. Its scope is the type definitions, the packaging rules for @types packages, and the contribution process, with language questions directed to the TypeScript handbook.
Official sources
Where developers are discussing it
Posts on Hacker News, dev.to and Lobsters that link to this repository, found by our scan of those communities. 1 in the last 30 days; newest first.
- Add On-Device Summarization to React with Chrome's Summarizer APIdev.to · Oct 24, 2026 · 5 points · 1 comments
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/definitelytyped-definitelytyped)Star history chart for your README
[](https://hysenlabs.com/projects/definitelytyped-definitelytyped)Was this useful?