0.0.4 • Published 6 years ago

tslang-client v0.0.4

Weekly downloads
7
License
MIT
Repository
github
Last release
6 years ago

tslang-client · Travis (.org) branch

A client implementation for tsserver for TypeScript. Currently, it's just working but not completely tested.

You can see the details about tsserver in the TypeScript wiki

Rationale

TypeScript provides a powerful Type System. So I was trying to leverage the Type System to make good tooling environment for TypeScript based projects. and I found some facts:

  • TypeScript provides full-featured Compiler API but slow and complicated.
  • ts-simple-ast provides well-designed wrapper API around the Compiler API but slow for my needs.
  • tsserver is fast but there is no library for communication with tsserver.

So I made this.

Requirements

  • TypeScript 2.8 or above

Installation

npm install --save-dev tslang-client

Usage

import { TsLangClient } from 'tslang-client';

// Create a client instance
const client = new TsLangClient();

// Connect to installed tsserver
await client.connect();

// Call open(file) api
await client.api.open({ file: 'filename.ts' });

// Close the connection
client.close();

Import with CommonJS

tslang-client supports CommonJS-style module along with the ES2015-style.

const { TsLangClient } = require('tslang-client');

EOF

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago