Getting Started
If you run into bugs with your library's official typings, you can copy them locally and tell TypeScript to use your local version using the "paths" field. In your tsconfig.json
:
Thanks to @adamrackis for the tip.
If you just need to add an interface, or add missing members to an existing interface, you don't need to copy the whole typing package. Instead, you can use declaration merging:
You dont always have to implement the module, you can simply import the module as any
for a quick start:
Because you don't have to explicitly import this, this is known as an ambient module declaration. You can do AMD's in a script-mode .ts
file (no imports or exports), or a .d.ts
file anywhere in your project.
You can also do ambient variable and ambient type declarations:
You can see examples of these included in the built in type declarations in the lib
field of tsconfig.json