• Stars
    star
    115
  • Rank 294,859 (Top 6 %)
  • Language
    JavaScript
  • License
    Other
  • Created almost 9 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Nicer TypeScript for API devs

NTypeScript is dead. Bring your own TypeScript 🌹

The following is left as legacy docs.

NTypeScript

Downloads BuildStatus

Nicer TypeScript, making it easier to work with the compiler API 🌹

NPM

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:

npm install ntypescript -g

or in your package.json

npm install ntypescript@latest --save --save-exact

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 ntsc exactly 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 require once from any file.

Replace TypeScript

For require('typescript') you can do that quite simply using your package.json:

"dependencies": {
    "typescript": "https://github.com/basarat/ntypescript/tarball/<release name>"
}

Release name example : 1.201506301047.1+e1c9d28cb0706f81c14ca95b92fa3e2a223cc60b

Grunt

This project comes with a built in grunt task called ntypescript. Just has just one task level option:

  • project : path to the project directory i.e. the directory that contains tsconfig.json.

Here is a sample Gruntfile.js for usage:

module.exports = function(grunt) {
    grunt.loadNpmTasks('ntypescript');

    grunt.initConfig({
        ntypescript: {
            options: {
                project: '.'
            }
        },
    });

    grunt.registerTask('default', ['ntypescript']);
};

NPM Scripts

Init and setup in package.json

npm init
npm install ntypescript@latest --save --save-exact
"scripts": {
    "build": "ntsc -p ./src"
},

And then you just need to do the following to build your project:

npm run build

About

Note that this is a personal endeavor, not officially by Microsoft.

More Repositories

1

ts-node

TypeScript execution and REPL for node.js
TypeScript
12,395
star
2

typedoc

Documentation generator for TypeScript projects.
TypeScript
7,349
star
3

ts-loader

TypeScript loader for webpack
TypeScript
3,413
star
4

fork-ts-checker-webpack-plugin

Webpack plugin that runs typescript type checker on a separate process.
TypeScript
1,918
star
5

atom-typescript

The only TypeScript package you will ever need
TypeScript
1,129
star
6

learn-typescript

The complete workshop for picking up TypeScript
TypeScript
692
star
7

tsify

Browserify plugin for compiling TypeScript
JavaScript
339
star
8

grunt-ts

A grunt task to manage your complete typescript development to production workflow
JavaScript
326
star
9

dts-bundle

Export TypeScript .d.ts files as an external module definition
TypeScript
307
star
10

ts-expect

Checks TypeScript types match expected values
TypeScript
193
star
11

tsconfig

Resolve and parse `tsconfig.json`, replicating TypeScript's behaviour
TypeScript
102
star
12

typedoc-default-themes

Handlebars
56
star
13

typedoc-site

Website for TypeDoc
TypeScript
37
star
14

grunt-typedoc

Grunt plugin to generate TypeScript docs with TypeDoc
JavaScript
16
star
15

tspms

An abstraction on top TypeScript language service, that let you consume it in the context of a project.
TypeScript
13
star
16

typedoc-auto-docs

An idea from TS Discord to automatically render docs for the ecosystem, similar to docs.rs and doc.deno.land
TypeScript
10
star
17

typescript-compiler-docs

Community docs about typescript's compiler and APIs
9
star
18

atom-typescript-examples

Temporary location of examples for mutual testing
JavaScript
8
star
19

tscs

TypeScript Compiler Services
JavaScript
7
star
20

ts-node-repros

Dockerfile
6
star
21

grunt-ts-clean

Grunt plugin to cleanup TypeScript builds for release.
JavaScript
6
star
22

typedoc-repros

Shell
5
star
23

csproj2ts

Library to parse TypeScript config info from a Visual Studio Project file
TypeScript
5
star
24

fs-fixture-builder

TypeScript
5
star
25

typedoc-action

TypeScript
5
star
26

tsproj

A specification for a file format + Parser Implementation for specifying TypeScript projects
TypeScript
5
star
27

grunt-dts-bundle

Grunt plugin to export TypeScript .d.ts files as an external module definition
JavaScript
4
star
28

typestrong.github.io

Website
HTML
4
star
29

typestrong-compiler

experimental compiler module
JavaScript
3
star
30

discussions

Open organization discussions
3
star
31

ts-node-examples

TypeScript
3
star