This package add new file extensions: *.ts
*.tsx
*.d.ts
.
This package use typescript@1.6.2. See detail about TypeScript.
All *.tsx?
files will be compiled to *.js
and bundld with your Meteor app. Also you can use it with module load system, See detail about meteor-systemjs.
This package is not bundle with any ts definiton files. As a alternative, you can use tsd
cli to manage you definition files. For that which are not managed by the tsd
or outdated, you must find/make it yourself. Because *.d.ts
files are also watch by the meteor watch system, just use it like a normal source file. TS Compiler will not compile definition to *.js
.
Meteor definiton flies can be found here Meteor TypeScript libraries
- Update to typescript@1.7.3.
- Improve error output.
- Improve sourecMap support.
- Fixed some bugs.
- BugFix: Some definition errors will cause compiler crash.
- Add
target
compile option support. - Add
noLib
compile option support.
- Incremental building supported
- When you use module system such as
system
andamd
, there will no closure surround your codes.
Just add this package to your app:
$ meteor add tsumina:meteor-typescript
An example with typescript. It's port of meteor offical tutorial. another one combined with meteor-aurelia
Assume you have never been used typescript:
$ npm i -g typescript # install typescript globally
$ npm i -g tsd # typescript definiton manager
$ meteor create MyTsApp # create your app
$ cd MyTsApp
$ tsc --init # this will create a tsconfig.json file at you root
$ tsd init # this will create a tsd.json file at you root
$ meteor add tsumina:meteor-typescript # add typescript compiler
These will create a new meteor app for you and typescript support ready!
On initialization, compiler will try to read compile options from tsconfig.json
which is in your app root directory. If failed, this will use dafault options instead.
- default options
"compilerOptions": {
"noEmitOnError": false,
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"declaration": false,
"jsx": "react",
"target": "ES5",
"module": "none"
}
You can use most of the boolean options except sourceMap
, noEmit
, declaration
and watch
. Beside these you also can set module
, system
and amd
are available. To use module system, you must add meteor-systemjs package to your meteor app.
$ meteor add tsumina:meteor-systemjs
By default, no module system will be used.
Compiler will running a typechecker on all source files and output errors. Since meteor system suggest to fix all the errors before next run but sometimes a reference error is not a problem for user. You can determining how to treat with errors via "noEmitOnError"
option. By default this set to false
will only raise the error information on the console but do not interrupt the app running. If have errors you will see something like this:
If set to "noEmitOnError": true
, you must fix all the errors before next run.
Notice
If there are fatal errors in your codes, compiler will down and throw errors. For this case, you must fix the errors whatever the compiler option is.
- Support TypeCheck
- Incremental building support
- examples for usage
- Improve README
- Full tests coverage
Code and documentation © 2015 TsumiNa Released under the MIT license.