Skip to content
This repository has been archived by the owner on Aug 8, 2018. It is now read-only.
/ meteor-typescript Public archive

[ABANDONED]A configurable typescript compiler to transform .ts files to .js to use it both side

Notifications You must be signed in to change notification settings

TsumiNa/meteor-typescript

Repository files navigation

Meteor-Typescript

Build Status Join the chat at https://gitter.im/TsumiNa/meteor-typescript

Use typescript with ES6 modules loader on both side!

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

Change Log

0.6.0

  • Update to typescript@1.7.3.

0.5.6

  • Improve error output.

0.5.3

  • Improve sourecMap support.
  • Fixed some bugs.

0.5.1

  • BugFix: Some definition errors will cause compiler crash.
  • Add target compile option support.
  • Add noLib compile option support.

0.3.0

  • Incremental building supported
  • When you use module system such as system and amd, there will no closure surround your codes.

Installation

Just add this package to your app:

$ meteor add tsumina:meteor-typescript

Usage

An example with typescript. It's port of meteor offical tutorial. another one combined with meteor-aurelia

Star from zero

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: noEmitOnError: false

If set to "noEmitOnError": true, you must fix all the errors before next run. noEmitOnError: true

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.

Roadmap

  • Support TypeCheck
  • Incremental building support
  • examples for usage
  • Improve README
  • Full tests coverage

Copyright and license

Code and documentation © 2015 TsumiNa Released under the MIT license.

About

[ABANDONED]A configurable typescript compiler to transform .ts files to .js to use it both side

Resources

Stars

Watchers

Forks

Packages

No packages published