0.0.3 • Published 10 years ago
grunt-simple-typescript v0.0.3
grunt-simple-typescript
A Grunt task for processing TypeScript files as modules. There are other grunt tasks that do this, but none in so simple and direct a manner.
Getting Started
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-simple-typescript --save-dev
To use add the simple-typescript
task to your Grunt configuration.
Referencing a Node API in TypeScript
// myLib.ts - expects a node.d.ts in the same dir.
///<reference path='node.d.ts' />
import util = require('util');
util.puts("Howdy!");
Referencing another TypeScript file
// myLib.ts
class MyLib {
run() {
// Do something
}
}
module.exports = MyLib;
// runner.ts
///<reference path='myLib.ts' />
new MyLib().run();
Transpiling your files
Manually run the task with grunt simple-typescript
or include it as part of your build task:
grunt.registerTask('build', ['clean', 'simple-typescript', '...']);