From e294beb3ac597957c3357add2b9269e7e8dbefd9 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sun, 8 Aug 2021 02:37:03 +0900 Subject: [PATCH] Add `.errors` to the `@babel/parser` return type definitions (#13653) --- packages/babel-parser/typings/babel-parser.d.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/babel-parser/typings/babel-parser.d.ts b/packages/babel-parser/typings/babel-parser.d.ts index 26907c0bc9..3f65949cee 100644 --- a/packages/babel-parser/typings/babel-parser.d.ts +++ b/packages/babel-parser/typings/babel-parser.d.ts @@ -11,7 +11,7 @@ export function parse( input: string, options?: ParserOptions -): import("@babel/types").File; +): ParseResult; /** * 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; 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 & { + errors: ParseError[]; +};