We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cb8a3d3 commit 4e7c3a3Copy full SHA for 4e7c3a3
1 file changed
packages/formatter/src/errorMessagePrettifier.ts
@@ -9,8 +9,9 @@ export type CodeBlockFn = (
9
export function createErrorMessagePrettifier(
10
codeBlock: CodeBlockFn
11
): (message: string) => Promise<string> {
12
+ const rules = getRules(codeBlock);
13
+
14
return async (message: string) => {
- const rules = await getRules(codeBlock);
15
let output = message;
16
17
for (const { pattern, replacer } of rules) {
@@ -35,7 +36,7 @@ type Rule = {
35
36
replacer: (...args: any[]) => string | Promise<string>;
37
};
38
-async function getRules(codeBlock: CodeBlockFn): Promise<Rule[]> {
39
+function getRules(codeBlock: CodeBlockFn): Rule[] {
40
const formatTypeScriptBlock = (code: string) => codeBlock(code, "typescript");
41
42
const formatSimpleTypeBlock = (code: string) => codeBlock(code, "type");
0 commit comments