ts-expose-status-plugin
TypeScript language service plugin to expose build status to external tools
Last updated 2 years ago by alangpierce .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ts-expose-status-plugin 
SYNC missed versions from official npm registry.

TypeScript expose status plugin

This is a TS language service plugin that exposes the current build state to the outside world. For example, you can use this to write a fast pre-commit check there are no TypeScript errors. Rather than needing to redo the typechecking from scratch, a CLI tool can connect directly to the language service running in your editor, which generally gives much faster results.

Usage

First add as a dev dependency:

yarn add --dev ts-expose-status-plugin

Then add as a compiler plugin to your tsconfig.json:

{
  "compilerOptions": {
    "plugins": [
      {"name": "ts-expose-status-plugin"}
    ]
  }
}

Then, from CLI code, you can connect to the language service and get all current errors:

import TSStatusClient from 'ts-expose-status-plugin/dist/TSStatusClient';

async function checkStatus(): void {
  await TSStatusClient.withClient({
    async onSuccess(client: TSStatusClient): Promise<void> {
      const errors = await client.getAllErrors();
      console.log(errors);
    },
    async onError(): Promise<void> {
      console.log('Failed to connect!');
    },
  });
}

There are also lower-level connect and disconnect static methods for keeping a persistent connection open.

Current Tags

  • 1.1.0                                ...           latest (2 years ago)

4 Versions

  • 1.1.0                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 1
Dependencies (3)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |