- it has type declarations, but not all of the ones you want
- it has type declarations, but you encounter an error that prevents you from writing your code
- it has type declarations, but they're incompatible with your module type
- it doesn't have type declarations at all
- Javascript is complex, so TypeScript must be complex, too
- There are multiple ways to express the same types
- Javascript package documentation is often unclear regarding types
- Scoping of declaration elements can be tricky
- Making declaration files compatible with different module systems is tricky
- It's hard to know what elements to type and what not to type
- Writing a declaration file leads to learning more about the package than you want to know
- Follow the recommendations at DefinitelyTyped
- Study existing declarations for similarly shaped packages at DefinitelyTyped
- Use the names from the documentation whenever possible
- Carefully select type names that communicate their usage
- Use namespaces to keep your declarations out of the global scope
- Respect the methods for using a package: ambient and/or external
- Don't try to get package owners to incorporate TypeScript declarations
- packages change over time, including being renamed
- if you fix an existing type declaration, contribute your change back to the community
...or pay a heavy "merge tax" during your subsequent updates
- existing type declarations
- TypeScript Handbook
but not typescript.codeplex.com - DefinitelyTyped
- contributing to DefinitelyTyped
- TypeScript v1.8 Language Spec
- Solicit help from package authors, if unsure
- Solicit help on the TypeScript IRC channel
package or spec | declaration | notes |
---|---|---|
tv4 | tv4 typings | |
imap | imap typings | SO help |
nodemailer-pickup-transport | nodemailer-pickup-transport typings | |
mailparser | mailparser typings | This package disappeared from DT at one point |
pino | pino typings | PR to DefinitelyTyped, feedback from package author |
seneca | seneca typings | help from package authors |
GeoJSON | GeoJSON typings | emailed author |
component-emitter | component-emitter typings | |
node | node.js typings |
- I recommend using DefinitelyTyped PRs for now
tsd and typings both use DefinitelyTyped
The other systems are too new, and I prefer to wait for other people to fix the bleeding edge problems. - put your submissions on a branch named after the package name