Skip to content

supership-jp/sprockets-typescript

 
 

Repository files navigation

This README needs some love. You can make it better!

sprockets-typescript

Build Status

This gem adds TypeScript support to Sprockets.

How to use TypeScript with Sprockets?

Add the following line in Gemfile:

gem "sprockets-typescript", github: "antage/sprockets-typescript"

Run bundle install.

And just add .js.ts extension to filename of typescript source.

How does TypeScript compiler extract type information from external files?

This gem adds all dependencies from ///<reference path="..."/> and import declarations to the compiler.

How to use sprockets-typescript and sprockets-commonjs together?

Example:

// app/javascripts/bar.module.js.ts

export function bar(): string {
    return "bar";
}
// app/javascripts/application.js.ts

import bar = module("bar.module");

bar.bar();

You need not add //=require bar directive in application.js.ts. bar.module.js.ts is required automagically (the compiler notifies sprockets about import declaration).

Why Sprockets can't find jquery.d.ts file?

Rename the file to jquery.d.js.ts.

About

TypeScript support for Sprockets

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 99.7%
  • Other 0.3%