If you are a TypeScript user like me, then you most likely used TSD aka TypeScript Definition manager for DefinitelyTyped. Now that TSD has officially been deprecated, you can either stick with TSD for the moment or upgrade to Typings now.
Firstly, lets uninstall TSD. You might have it installed locally and globally depending on your setup: npm uninstall tsd
and npm uninstall tsd -g
Now keep in mind your typings
folder will be completely changed to accommodate the new structure that Typings uses in comparison to TSD. If you have any custom typings in your folder either created by you or manually copied/pasted, back them up somewhere.
Now you are ready to install Typings. So simply run: npm install typings -g
to install globally for use via CLI.
Now we will upgrade our tsd.json
file to the new typings.json
format which looks and works completely different using the upgrade command. Simply type: typings init --upgrade
to start the process. You can now safely remove your tsd.json
file and you should see typings.json
in the root.
Now the last step is to pull down your typing files by running: typings install
this will add a heap of dependencies to your typings folder. You now have type defintions installed via Typings.
In your newly populated typings
folder you will notice (if you had existing typing files) two folders and two files: browser, main, browser.d.ts and main.d.ts.
The .d.ts
files in the root of the folder are mapping files similarly to tsd.d.ts
they’re both largely the same, except if you are dealing with primarily a front-end application, reference the browser.d.ts
file instead of the main as it has some browser specific overrides.
Keep in mind you will need to edit your tsconfig.json
file as well to ensure your files
or filesGlob
sections reference the appropriate files. The following is a sample of my tsconfig.json
file in my Aurelia application. Notice the ./typings/browser.d.ts
reference?
"filesGlob": [
"./src/**/*.ts",
"./test/**/*.ts",
"./typings/browser.d.ts",
"./jspm_packages/**/*.d.ts"
],
In my next post, I will be detailing how to upgrade Aurelia to use Typings over TSD.