This document and related files show how a basic working setup for Meteor is created with TypeScript and Angular 2.
The following preconditions apply:
- Meteor 1.2 installed
- NodeJS installed (I used 5.7)
-
Create a new Meteor project
-
Install / remove the following packages for Meteor:
$ meteor add urigo:angular2-meteor $ meteor remove angular $ meteor remove blaze-html-templates $ meteor remove ecmascript
-
Install additional TypeScript definitions from inside the Meteor project folder (not sure if step is needed):
$ npm install typings -g $ typings install meteor --ambient $ typings install es6-shim --ambient $ typings install es6-promise --ambient
-
Create the 'tsconfig.json' and 'typings.json' files in the Meteor project folder
-
Create the 'index.html' in the 'client' sub-directory of the Meteor project folder
-
Create the 'main.ts' in the 'client/app' sub-directory of the Meteor project folder
For integration with WebStorm / IntelliJ, use the following plugins:
- JavaScript
- NodeJS
- Meteor
Make sure to configure the TypeScript compiler to use the tsconfig.json file for compiler settings. This is also the reason we added the "outDir" config param. Normally the TypeScript compiler will output the *.js files to the same location as their original *.ts files. But this clashes when then starting Meteor with the following error:
Error: Path reservation conflict: app/client/app/main.js
By compiling to the same location as where Meteor will put the files, Meteor will overwrite the file when starting, preventing conflicts.