Type a JavaScript library with TypeScript declaration files
8 steps · about 1 h 40 min · Intermediate
- Learn what declaration files are for (article, TypeScript, 5 min)
Maps the handbook section you will work through.
- Write declarations by example (tutorial, TypeScript, 20 min)
Turns API docs into declare statements, one pattern at a time.
- Identify the library's structure (article, TypeScript, 15 min)
Global, module or UMD decides which template to use.
- Use the template for global libraries (reference, TypeScript, 10 min)
A starting point for script-tag libraries.
- Understand how declarations merge (article, TypeScript, 15 min)
Explains value, type and namespace meanings of one name.
- Generate .d.ts files from JSDoc-annotated JavaScript (tutorial, TypeScript, 10 min)
Lets the compiler write declarations for you.
- Install and use types from @types (reference, TypeScript, 5 min)
How projects pick up typings you or others publish.
- Contribute types to DefinitelyTyped (repo, GitHub, 20 min)
The home of community typings and its contribution rules.