Skip to content
This repository has been archived by the owner on Nov 18, 2019. It is now read-only.
/ ecmascript-ts Public archive

Typescript support for Meteor ecmascript compiler

License

Notifications You must be signed in to change notification settings

lmachens/ecmascript-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Babel TypeScript Compiler for Meteor

This package allows Meteor to compile TypeScript files with Babel.

Usage

lmachens:ecmascript-ts will register a new compiler for .ts and .tsx files. It uses the same BabelCompiler ecmascript package is using.

meteor add lmachens:ecmascript-ts

meteor npm install --save-dev @babel/preset-typescript

Make sure your .babelrc has the @babel/preset-typescript preset:

{
    "presets": [
        "@babel/env",
        "@babel/preset-typescript"
    ]
}

Meteor will now compile .ts and .tsx files with the babel compiler. Note that Babel will not perform type-checking on Typescript code. You still need TypeScript to read from .d.ts files. This can be done by a separate tsc --watch task or in some tests.

meteor npm install --save-dev typescript

Add these scripts to your package.json:

{
  "scripts": {
    "test-types": "tsc",
    "watch-types": "tsc --watch"
  }
}

Meteor type definitions

It is recommended to install Meteor type definitions:

meteor npm install --save-dev @types/meteor

How does it work?

There is a good article which describes how Babel and TypeScript works together. And there is a discussion in the meteor-feature-requests.

About

Typescript support for Meteor ecmascript compiler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published