This repository has been archived by the owner. It is now read-only.
An AMD loader plugin for TypeScript
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
build
example
src
vendor
.gitignore
.gitmodules
README.md
grunt.js
package.json

README.md

require-ts

require-ts is a Require.js plugin that allows you to require TypeScript dependencies into your project.

Download

Usage

You leverage require-ts like any other require.js plugin! Simply place "ts!" before your dependency path, make sure to leave off the file extension.

define(['ts!a/typescript/dep'], function(dep) {
  // dep is compiled to JS at this point.
});

You can also see the "example" folder, where require-ts is being used to run the Microsoft provided greeter sample.

Type Declarations

You can load in TypeScript type declaration files by adding some configuration to your require.js configuration. Ultimately a a string of the source needs to be passed into the compiler and for the time being you can use the text! plugin.

requirejs.config({
  ts: {
    declarations: [
      'text!../vendor/typescript/bin/lib.d.ts',
      'text!../vendor/typescript/bin/jquery.d.ts'
    ]
  }
});

Build

npm install && grunt build

Implementation Details

This project leverages git submodules to embed the TypeScript project. This allows us to automate the build for a new version of the plugin as the TypeScript project moves forward. We leverage grunt and rigger to build the plugin.

Author

Credits

The text loading mechanisms is extracted from require-cs, the work done by James Burke.

License

Available via the MIT or new BSD license.