If you are using the TypeScript Skeleton application provided by the Aurelia team, then at the time of writing this, the project is still using TSD (well it has a tsd.d.ts file in the typings folder). The TypeScript Definition Manager as of a few hours ago of writing this post has been deprecated in favour of Typings instead which is a considerably more flexible and easier to use type management tool.
I previously wrote and published an article on converting TSD over to use Typings, which you need to read and follow along with before continuing on with this article. This is step one in the process. As you know Aurelia uses Gulp tasks to handle loading typing definitions from jspm_packages
and your typings
directory.
Firstly we want to open the paths.js
file located in /build
it contains various source directories and output directories as well. At the bottom of this file, you will notice dtsSrc
which is an array of paths, it will look like something below:
dtsSrc: [
'typings/**/*.ts',
'./jspm_packages/**/*.d.ts'
]
Now you want to change this to look like something like this:
dtsSrc: [
'./typings/browser/**/*.d.ts',
'./jspm_packages/**/*.d.ts'
]
You probably notice that Typings creates a browser directory, this contains browser specific typings and is the recommended location for your Aurelia application. As noted in the above link, you want to tell tsconfig.json
which your IDE and TypeScript uses to determine paths, etc.
You will want to replace the filesGlob
array of paths with the following:
"filesGlob": [
"./src/**/*.ts",
"./test/**/*.ts",
"./typings/browser.d.ts",
"./jspm_packages/**/*.d.ts"
]
This will load the browser mapping file for our typings and ensure we get awesome intellisense and things work.
Conclusion
That’s it. There aren’t many steps from the initial post, just a couple of paths to update. If you get stuck or didn’t understand something, drop a comment and I will gladly help.