-
Notifications
You must be signed in to change notification settings - Fork 13k
Description
Proposal
You simply do require('typescript').register()
and then all require
calls e.g. var foo = require('./foo')
would load foo.ts
if foo.js/json/etc
are not found.
This would mean we would compile in-memory and completely skip all type checking and do a fast emit. This would however greatly help increase .ts
adaption IMHO.
Currently there is a userland maintained : https://github.com/TypeStrong/ts-node
Motivation
CoffeeScript supports this via require('coffee-script').register();
(synonym for require('coffee-script/register');
) so that once you call this function it patches require
to support .coffee
files.
E.g.
The implementation for coffeescript can be found here : http://coffeescript.org/documentation/docs/register.html
Where in typescript
This can potentially be done in an external NPM package, but:
- having it officially support would enhance adaption.
- give better statistics for
typescript
npm package as users would startrequire
ingtypescript
(coffeescript downloads https://www.npmjs.com/package/coffee-script)