NicerTypeScript, making it easier to work with the compiler API 🌹
Kudos to the TypeScript team for maintaining all the code that this project depends on. This project is just a minor automation on top.
Niceness list:
Releases everyday.
Consistent side by side usage (just add an n prefix): require('ntypescript'), ntsc
package.json links you to typescript definitions (using typescript.definition entry)
Super Nice: We expose the internal APIs (the ones that have /* internal */)
Super Nice: We expose the global ts variable. Just require('ntypescript') once and start using ts like you are in the actual compiler source code.
Super Nice: Converts const enum in the compiler definition to enum. This decreases the typescript compiler version dependence on your dev tools TS->JS emit.
Easier to muck around with the compiler / language service when installed from NPM. Just open any file from node_modules/ntypescript/src folder in atom-typescript and press f6 to get a new local rebuild.
Design incompatibilities:
This project does not ship with tsserver.
Install
Similar to typescript you can install and use ntypescript globally:
Each release is named after the day it was built and the git commit hash in Microsoft/TypeScript/master that it was built from. We recommend adding save-exact as there are no guarantees on when stuff might break and you want your users to get the same version you tested.
Usage
Globally
You can use ntscexactly like the tsc command line tool.
Require
Use require('ntypescript')
Global ts
In addition to returning what typescript returns we also expose ts as a global.
declare var require: any;require('ntypescript');console.log(ts.createScanner);
Which makes it easy to use the compiler API if you are using it heavily. Note you only need to requireonce from any file.
Replace TypeScript
For require('typescript') you can do that quite simply using your package.json: