File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export default class Plugin {
99 pre ?: PluginObject [ "pre" ] ;
1010 visitor : PluginObject [ "visitor" ] ;
1111
12- parserOverride ?: Function ;
12+ parserOverride ?: PluginObject [ "parserOverride" ] ;
1313 generatorOverride ?: Function ;
1414
1515 options : object ;
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import type {
1111 OptionPath ,
1212 RootPath ,
1313} from "./option-assertions.ts" ;
14- import type { ParserOptions } from "@babel/parser" ;
14+ import type { parse , ParserOptions } from "@babel/parser" ;
1515import type { Visitor } from "@babel/traverse" ;
1616import type { ValidatedOptions } from "./options.ts" ;
1717import type { File , PluginAPI , PluginPass } from "../../index.ts" ;
@@ -93,7 +93,9 @@ export type PluginObject<S extends PluginPass = PluginPass> = {
9393 dirname : string ,
9494 ) => PluginObject ;
9595 visitor ?: Visitor < S > ;
96- parserOverride ?: Function ;
96+ parserOverride ?: (
97+ ...args : [ ...Parameters < typeof parse > , typeof parse ]
98+ ) => ReturnType < typeof parse > ;
9799 generatorOverride ?: Function ;
98100} ;
99101
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ export default function* parser(
2929 } else if ( results . length === 1 ) {
3030 // If we want to allow async parsers
3131 yield * [ ] ;
32- if ( typeof results [ 0 ] . then === "function" ) {
32+ if ( typeof ( results [ 0 ] as any ) . then === "function" ) {
3333 throw new Error (
3434 `You appear to be using an async parser plugin, ` +
3535 `which your current version of Babel does not support. ` +
You can’t perform that action at this time.
0 commit comments