A fork of https://github.com/yoavbls/pretty-ts-errors. It transforms TypeScript errors into markdown.
simplescreenrecorder-2024-02-03_19.11.18.mp4
※ Global
npm i -g pretty-ts-errors-markdown
※ Local
npm i pretty-ts-errors-markdown
※ 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
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);
Awesome thanks to yoavbls and other contributors for the original pretty-ts-errors