Add .errors to the @babel/parser return type definitions (#13653)
This commit is contained in:
parent
5884adaa93
commit
e294beb3ac
13
packages/babel-parser/typings/babel-parser.d.ts
vendored
13
packages/babel-parser/typings/babel-parser.d.ts
vendored
@ -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[];
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user