pretty-ts-errors-lsp
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -16,3 +16,3 @@ "use strict"; | ||
} | ||
const prettyType = format(type); | ||
const prettyType = convertToOriginalType(prettifyType(convertToValidType(type), format)); | ||
if (prettyType.includes("\n")) { | ||
@@ -29,17 +29,11 @@ return `${prefix}: ${(0, components_1.multiLineCodeBlock)(prettyType, "type")}`; | ||
*/ | ||
// function prettifyType(type: string) { | ||
// try { | ||
// // Wrap type with valid statement, format it and extract the type back | ||
// return convertToOriginalType( | ||
// prettify(convertToValidType(type), { | ||
// parser: "typescript", | ||
// printWidth: 60, | ||
// singleAttributePerLine: false, | ||
// arrowParens: "avoid", | ||
// }) | ||
// ); | ||
// } catch (e) { | ||
// return type; | ||
// } | ||
// } | ||
function prettifyType(type, format) { | ||
try { | ||
// Wrap type with valid statement, format it and extract the type back | ||
return convertToOriginalType(format(convertToValidType(type))); | ||
} | ||
catch (e) { | ||
return type; | ||
} | ||
} | ||
const convertToValidType = (type) => `type x = ${type | ||
@@ -46,0 +40,0 @@ // Add missing parentheses when the type ends with "..."" |
@@ -6,3 +6,3 @@ { | ||
"description": "Make TypeScript errors prettier and more human-readable in VSCode", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"icon": "assets/icon.png", | ||
@@ -9,0 +9,0 @@ "repository": { |
27738
491