tslang-client
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i tslang-client

Weekly Downloads

1

Version

0.0.4

License

MIT

Unpacked Size

61.2 kB

Total Files

33

Last publish

Collaborators

  • appetizermonster