Ambient Declarations in TypeScript
Ambient declarations use the declare keyword to tell TypeScript about values that exist at runtime but were not written in TypeScript. Learn how and when to use them.
Type-safe JavaScript with TypeScript
Ambient declarations use the declare keyword to tell TypeScript about values that exist at runtime but were not written in TypeScript. Learn how and when to use them.
Learn how to add TypeScript types to npm packages that ship without them. Create declaration files for untyped JavaScript libraries so you get autocomplete and type safety.
Learn how to find, install, and use @types packages to add type definitions for JavaScript libraries in your TypeScript project.
DefinitelyTyped is the community repository that powers @types packages. Learn what it is, how it works, and how to find and contribute type definitions.
Learn how to publish TypeScript declaration files for your npm package, whether by bundling types with your code or publishing to the @types organization.
Avoid the most common mistakes when writing TypeScript declaration files. Learn the right patterns for types, callbacks, overloads, and module structure.
Understand the most important tsconfig.json options: target, module, outDir, rootDir, strict, lib, sourceMap, and more. Learn what each one controls and how to choose the right values.
Strict mode enables every type-safety check TypeScript offers. Learn what strict: true does, which checks it enables, and why you should use it from day one.
noImplicitAny forces you to annotate types wherever TypeScript cannot infer them. Learn what it does, why it catches hidden bugs, and how to fix the errors it surfaces.
strictNullChecks makes null and undefined their own distinct types. Learn how it catches the most common runtime error in JavaScript and how to handle nullable values safely.
Target controls the JavaScript version TypeScript emits. Lib controls which built-in APIs are available for type-checking. Learn how they work together and how to choose the right values.
Incremental builds cache information about your project so TypeScript only rechecks what changed. Learn how to enable them and when they help speed up compilation.