@k88/typescript-compile-error-formatter
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

@k88/typescript-compile-error-formatter

A error formatter for typescript compile errors, taken from react-dev-utils, but is published as a standalone module and has Typescript definition.

Installation

This formatter best works with the output of fork-ts-checker-webpack-plugin and is used as a peer dependency. Install both using:

npm install @k88/typescript-compile-error-formatter fork-ts-checker-webpack-plugin --save-dev

Usage

Use it for a formatted error message form fork-ts-checker-webpack-plugin:

import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import typescriptFormatter from '@k88/typescript-compile-error-formatter';

forkTsCheckerWebpackPlugin
    .getCompilerHooks(compiler)
    .receive.tap('afterTypeScriptCheck', (diagnostics, lints) => {
        [...diagnostics, ...lints].forEach(msg, => typescriptFormatter(msg, true));
      });

Package Sidebar

Install

npm i @k88/typescript-compile-error-formatter

Weekly Downloads

6,114

Version

2.1.0

License

ISC

Unpacked Size

9.43 kB

Total Files

6

Last publish

Collaborators

  • ktalebian