@samitouri / QOS-React-2 / commits / 37452089fb

[ez] CompilerError: optional description and suggestions

--- Many compiler errors have neither descriptions nor suggestions (e.g. most `todo` or `invariant` errors), so let's make those optional

Mofei Zhang committed Mar 18, 2024 at 12:09 UTC 37452089fba2492cbc622b80d9e987193f343054
1 file changed +2 -2
compiler/packages/babel-plugin-react-forget/src/CompilerError.ts
+2 -2
@@ -51,7 +51,7 @@ export type CompilerErrorDetailOptions = {
51 description?: string | null | undefined;
52 severity: ErrorSeverity;
53 loc: SourceLocation | null;
54 - suggestions: Array<CompilerSuggestion> | null;
54 + suggestions?: Array<CompilerSuggestion> | null | undefined;
55 };
56
57 /*
@@ -83,7 +83,7 @@ export class CompilerErrorDetail {
83
84 printErrorMessage(): string {
85 const buffer = [`${this.severity}: ${this.reason}`];
86 - if (this.description !== null) {
86 + if (this.description != null) {
87 buffer.push(`. ${this.description}`);
88 }
89 if (this.loc != null && typeof this.loc !== "symbol") {