@@ -26,13 +26,14 @@ import type * as t from "@babel/types";
2626const { isCompatTag } = react ;
2727import type { VirtualTypeAliases } from "./virtual-types" ;
2828
29- type Opts < Object > = Partial < {
30- [ Prop in keyof Object ] : Object [ Prop ] extends t . Node
31- ? t . Node | Object [ Prop ]
32- : Object [ Prop ] extends t . Node [ ]
33- ? t . Node [ ] | Object [ Prop ]
34- : Object [ Prop ] ;
29+ type Opts < Obj > = Partial < {
30+ [ Prop in keyof Obj ] : Obj [ Prop ] extends t . Node
31+ ? t . Node
32+ : Obj [ Prop ] extends t . Node [ ]
33+ ? t . Node [ ]
34+ : Obj [ Prop ] ;
3535} > ;
36+
3637export interface VirtualTypeNodePathValidators {
3738 isBindingIdentifier < T extends t . Node > (
3839 this : NodePath < T > ,
@@ -210,15 +211,23 @@ export function isForAwaitStatement(this: NodePath): boolean {
210211 return isForOfStatement ( this . node , { await : true } ) ;
211212}
212213
213- // TODO: Remove in Babel 8
214- export function isExistentialTypeParam ( this : NodePath ) : void {
215- throw new Error (
216- "`path.isExistentialTypeParam` has been renamed to `path.isExistsTypeAnnotation()` in Babel 7." ,
217- ) ;
218- }
219-
220- export function isNumericLiteralTypeAnnotation ( this : NodePath ) : void {
221- throw new Error (
222- "`path.isNumericLiteralTypeAnnotation()` has been renamed to `path.isNumberLiteralTypeAnnotation()` in Babel 7." ,
223- ) ;
214+ if ( ! process . env . BABEL_8_BREAKING ) {
215+ if ( ! USE_ESM ) {
216+ // eslint-disable-next-line no-restricted-globals
217+ exports . isExistentialTypeParam = function isExistentialTypeParam (
218+ this : NodePath ,
219+ ) : void {
220+ throw new Error (
221+ "`path.isExistentialTypeParam` has been renamed to `path.isExistsTypeAnnotation()` in Babel 7." ,
222+ ) ;
223+ } ;
224+
225+ // eslint-disable-next-line no-restricted-globals
226+ exports . isNumericLiteralTypeAnnotation =
227+ function isNumericLiteralTypeAnnotation ( this : NodePath ) : void {
228+ throw new Error (
229+ "`path.isNumericLiteralTypeAnnotation()` has been renamed to `path.isNumberLiteralTypeAnnotation()` in Babel 7." ,
230+ ) ;
231+ } ;
232+ }
224233}
0 commit comments