Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ParseError Much Simpler now that we can use TypeScript #14796

Merged
merged 8 commits into from
Jul 25, 2022
Prev Previous commit
Next Next commit
Use SyntaxPlugin everywhere. TypeScript doesn't seem to care either w…
…ay, and we may want to change this back to string when we allow custom sytnax plugins (or "SyntaxPlugin | string" just to convey this a bit better, even though that would be the same).

Reviewed by @tolmasky.
  • Loading branch information
tolmasky committed Jul 25, 2022
commit afbaa2cfef1ad66252314464718bb0979a435a09
4 changes: 2 additions & 2 deletions packages/babel-parser/src/parse-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface ParseErrorSpecification<ErrorDetails> {
// as readonly, so let's just not worry about it for now.
code: ParseErrorCode;
reasonCode: string;
syntaxPlugin?: string;
syntaxPlugin?: SyntaxPlugin;
missingPlugin?: string | string[];
loc: Position;
details: ErrorDetails;
Expand Down Expand Up @@ -130,7 +130,7 @@ export function ParseErrorEnum(a: TemplateStringsArray): <

export function ParseErrorEnum<T extends ParseErrorTemplates>(
parseErrorTemplates: T,
syntaxPlugin?: string,
syntaxPlugin?: SyntaxPlugin,
): {
[K in keyof T]: ParseErrorConstructor<
T[K] extends { message: string | ToMessage<any> }
Expand Down