Definitely Typed Deployment and Usage Guide
Prerequisites
- Node.js (version 16 or later recommended)
- pnpm (package manager for monorepo management)
- TypeScript (for development and testing)
- Git (for version control and repository management)
Installation
-
Clone the repository:
git clone https://github.com/DefinitelyTyped/DefinitelyTyped.git cd DefinitelyTyped -
Clean and install dependencies:
# On Windows: node ./scripts/clean-node-modules.js # On other platforms: git clean -fdx pnpm install --filter .
Configuration
- No specific environment variables are required for local development
- TypeScript configuration is handled by the monorepo structure
- API keys are not needed for local development
Build & Run
For Contributors (Testing Changes)
-
Test editing an existing package:
- Navigate to the package in
node_modules/@types/foo/index.d.ts - Make changes and validate them
- Use the package in your project to test
- Navigate to the package in
-
Testing with local type definitions:
// Create typename.d.ts in your project declare module "libname" { export function helloWorldMessage(): string; }
For Repository Maintenance
-
Type checking and linting:
pnpm run build pnpm run lint -
Running tests:
pnpm test
Deployment
Publishing to npm
Definitely Typed packages are automatically published to npm through the DefinitelyTyped-tools publisher.
For Contributors:
- Submit a pull request with your type definitions
- Once merged, packages are automatically published based on the schedule
- Check the publishing status for updates
Repository Status
- Build status: Check the CI badge for current build health
- Package status: All packages should be type-checking/linting cleanly
- Support window: Packages are tested on TypeScript versions less than 2 years old
Troubleshooting
Common Issues
-
"Package not found" when installing types:
- Ensure you're using the correct naming convention:
@types/package-name - For scoped modules, use double underscores:
@types/babel__preset-env
- Ensure you're using the correct naming convention:
-
Types not being automatically included:
- Add a
typesreference if not using modules:/// <reference types="node" />
- Add a
-
Outdated types for older TypeScript versions:
- Use tagged versions from npm:
npm dist-tags @types/react - Example: TypeScript 2.5 can use
react@16.0types
- Use tagged versions from npm:
-
Repository layout issues after recent changes:
- Run
git clean -fdxto clean up node_modules - Reinstall with
pnpm install --filter .
- Run
-
Build failures:
- Check the infrastructure status updates
- Verify all packages are type-checking cleanly
Support
- Discord: Join the TypeScript Community Discord server and use the Definitely Typed channel
- Documentation: Refer to the TypeScript handbook for declaration file concepts
Legacy Support
For TypeScript 1.*:
- Manually download from the
masterbranch - Place in your project directory
- Add manual triple-slash references as needed