Add .errors to the @babel/parser return type definitions (#13653)

This commit is contained in:
Sosuke Suzuki 2021-08-08 02:37:03 +09:00 committed by GitHub
parent 5884adaa93
commit e294beb3ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,7 @@
export function parse(
input: string,
options?: ParserOptions
): import("@babel/types").File;
): ParseResult<import("@babel/types").File>;
/**
* Parse the provided code as a single expression.
@ -19,7 +19,7 @@ export function parse(
export function parseExpression(
input: string,
options?: ParserOptions
): import("@babel/types").Expression;
): ParseResult<import("@babel/types").Expression>;
export interface ParserOptions {
/**
@ -180,3 +180,12 @@ export const tokTypes: {
// todo(flow->ts) real token type
[name: string]: any;
};
export interface ParseError {
code: string;
reasonCode: string;
}
type ParseResult<Result> = Result & {
errors: ParseError[];
};