pretty-ts-errors-markdown

0.0.8 • Public • Published

pretty-ts-errors-markdown

A fork of https://github.com/yoavbls/pretty-ts-errors. It transforms TypeScript errors into markdown.

https://github.com/hexh250786313/pretty-ts-errors-markdown/assets/26080416/e22dfcd6-2ca6-46e9-9abd-cce1cc56e63a

Install

※ Global

npm i -g pretty-ts-errors-markdown

※ Local

npm i pretty-ts-errors-markdown

Usage (CLI)

※ Use inline parameters

pretty-ts-errors-markdown -i "{\"range\":{\"start\":{\"line\":6,\"character\":6},\"end\":{\"line\":6,\"character\":7}},\"message\":\"Variable 'a' implicitly has an 'any' type.\",\"code\":7005,\"severity\":1,\"source\":\"tsserver\"}"

※ Use standard input

git clone https://github.com/hexh250786313/pretty-ts-errors-markdown && cd pretty-ts-errors-markdown
cat ./examples/input.txt | pretty-ts-errors-markdown > ./examples/output.md

Usage (Programmatically)

import { formatDiagnostic } from "pretty-ts-errors-markdown";
import { Diagnostic } from "vscode-languageserver-types";

const diagnostic: Diagnostic = {
  range: {
    start: { line: 6, character: 6 },
    end: { line: 6, character: 7 },
  },
  message: "Variable 'a' implicitly has an 'any' type.",
  code: 7005,
  severity: 1,
  source: "tsserver",
};

const marked = formatDiagnostic(diagnostic);
console.log(marked);

Credits

Awesome thanks to yoavbls and other contributors for the original pretty-ts-errors

Readme

Keywords

none

Package Sidebar

Install

npm i pretty-ts-errors-markdown

Weekly Downloads

34

Version

0.0.8

License

none

Unpacked Size

62 kB

Total Files

69

Last publish

Collaborators

  • hexh250786313