typescript-ruby / typescript-rails

An asset pipeline wrapper for the TypeScript language
MIT License
255 stars 30 forks source link

ES6 Modules? #35

Open reid-rigo opened 8 years ago

reid-rigo commented 8 years ago

This gem doesn't appear to allow ES6 import/export syntax. Is there a way to do this with the asset pipeline?

jll90 commented 8 years ago

I'm using the typescript-rails gem and Rails 4.

Here's what I did to export a module.

//myMod.ts
module myMod {

  export myFunction (){

  }

  export myClass (){

  }
}

Then, in another file you can import using the following: /// <reference path="./myMod.ts" />

You can call myMod.myFunction(); inside any other file.