From 5a5dbccb7d04f99fbd22e7da298c1728eeae9b1e Mon Sep 17 00:00:00 2001 From: Siddarth Kumar Date: Thu, 11 May 2023 12:46:45 +0530 Subject: [PATCH] Add `getResolvedTypeAnnotation ` to Parsers --- .../parsers/__tests__/parsers-commons-test.js | 15 +-- .../src/parsers/flow/modules/index.js | 3 +- .../src/parsers/flow/parser.js | 79 +++++++++++++++- .../src/parsers/flow/utils.js | 75 +-------------- .../src/parsers/parser.js | 10 ++ .../src/parsers/parserMock.js | 77 +++++++++++++++- .../src/parsers/parsers-commons.js | 14 +-- .../src/parsers/typescript/modules/index.js | 4 +- .../src/parsers/typescript/parser.js | 91 ++++++++++++++++++- .../src/parsers/typescript/utils.js | 91 +------------------ 10 files changed, 260 insertions(+), 199 deletions(-) diff --git a/packages/react-native-codegen/src/parsers/__tests__/parsers-commons-test.js b/packages/react-native-codegen/src/parsers/__tests__/parsers-commons-test.js index 4704e445f75651..047bb00d8a545f 100644 --- a/packages/react-native-codegen/src/parsers/__tests__/parsers-commons-test.js +++ b/packages/react-native-codegen/src/parsers/__tests__/parsers-commons-test.js @@ -58,7 +58,6 @@ const flowParser = new FlowParser(); const {flowTranslateTypeAnnotation} = require('../flow/modules/index'); const typeScriptTranslateTypeAnnotation = require('../typescript/modules/index'); -const {resolveTypeAnnotation} = require('../flow/utils'); beforeEach(() => { jest.clearAllMocks(); @@ -409,7 +408,7 @@ describe('buildSchemaFromConfigType', () => { (_ast, _parser) => componentSchemaMock, ); const buildModuleSchemaMock = jest.fn( - (_0, _1, _2, _3, _4, _5) => moduleSchemaMock, + (_0, _1, _2, _3, _4) => moduleSchemaMock, ); const buildSchemaFromConfigTypeHelper = ( @@ -424,7 +423,6 @@ describe('buildSchemaFromConfigType', () => { buildComponentSchemaMock, buildModuleSchemaMock, parser, - resolveTypeAnnotation, flowTranslateTypeAnnotation, ); @@ -507,7 +505,6 @@ describe('buildSchemaFromConfigType', () => { astMock, expect.any(Function), parser, - resolveTypeAnnotation, flowTranslateTypeAnnotation, ); @@ -679,7 +676,6 @@ describe('buildSchema', () => { buildModuleSchema, Visitor, parser, - resolveTypeAnnotation, flowTranslateTypeAnnotation, ); @@ -713,7 +709,6 @@ describe('buildSchema', () => { buildModuleSchema, Visitor, flowParser, - resolveTypeAnnotation, flowTranslateTypeAnnotation, ); @@ -768,7 +763,6 @@ describe('buildSchema', () => { buildModuleSchema, Visitor, flowParser, - resolveTypeAnnotation, flowTranslateTypeAnnotation, ); @@ -1064,7 +1058,6 @@ describe('buildModuleSchema', () => { ast, tryParse, flowParser, - resolveTypeAnnotation, flowTranslateTypeAnnotation, ), ).toThrow(expected); @@ -1079,7 +1072,6 @@ describe('buildModuleSchema', () => { ast, tryParse, flowParser, - resolveTypeAnnotation, flowTranslateTypeAnnotation, ), ).not.toThrow(); @@ -1116,7 +1108,6 @@ describe('buildModuleSchema', () => { ast, tryParse, flowParser, - resolveTypeAnnotation, flowTranslateTypeAnnotation, ), ).toThrow(expected); @@ -1131,7 +1122,6 @@ describe('buildModuleSchema', () => { ast, tryParse, flowParser, - resolveTypeAnnotation, flowTranslateTypeAnnotation, ), ).not.toThrow(); @@ -1171,7 +1161,6 @@ describe('buildModuleSchema', () => { ast, tryParse, flowParser, - resolveTypeAnnotation, flowTranslateTypeAnnotation, ), ).toThrow(expected); @@ -1186,7 +1175,6 @@ describe('buildModuleSchema', () => { ast, tryParse, flowParser, - resolveTypeAnnotation, flowTranslateTypeAnnotation, ), ).not.toThrow(); @@ -1229,7 +1217,6 @@ describe('buildModuleSchema', () => { ast, tryParse, flowParser, - resolveTypeAnnotation, flowTranslateTypeAnnotation, ); diff --git a/packages/react-native-codegen/src/parsers/flow/modules/index.js b/packages/react-native-codegen/src/parsers/flow/modules/index.js index 75352fea2bf67e..1859a59666b92c 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/index.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/index.js @@ -22,7 +22,6 @@ import type { import type {Parser} from '../../parser'; import type {ParserErrorCapturer, TypeDeclarationMap} from '../../utils'; -const {resolveTypeAnnotation} = require('../utils'); const { unwrapNullable, wrapNullable, @@ -60,7 +59,7 @@ function translateTypeAnnotation( parser: Parser, ): Nullable { const {nullable, typeAnnotation, typeResolutionStatus} = - resolveTypeAnnotation(flowTypeAnnotation, types); + parser.getResolvedTypeAnnotation(flowTypeAnnotation, types); switch (typeAnnotation.type) { case 'GenericTypeAnnotation': { diff --git a/packages/react-native-codegen/src/parsers/flow/parser.js b/packages/react-native-codegen/src/parsers/flow/parser.js index 5758bfb404643a..d2f2de8f514a06 100644 --- a/packages/react-native-codegen/src/parsers/flow/parser.js +++ b/packages/react-native-codegen/src/parsers/flow/parser.js @@ -23,7 +23,13 @@ import type { } from '../../CodegenSchema'; import type {ParserType} from '../errors'; import type {GetSchemaInfoFN, GetTypeAnnotationFN, Parser} from '../parser'; -import type {ParserErrorCapturer, TypeDeclarationMap, PropAST} from '../utils'; +import type { + ParserErrorCapturer, + TypeDeclarationMap, + PropAST, + TypeResolutionStatus, +} from '../utils'; +const invariant = require('invariant'); const { getSchemaInfo, @@ -40,7 +46,6 @@ const {Visitor} = require('../parsers-primitives'); const {buildComponentSchema} = require('./components'); const {wrapComponentSchema} = require('../schema.js'); const {buildModuleSchema} = require('../parsers-commons.js'); -const {resolveTypeAnnotation} = require('./utils'); const fs = require('fs'); @@ -111,7 +116,6 @@ class FlowParser implements Parser { buildModuleSchema, Visitor, this, - resolveTypeAnnotation, flowTranslateTypeAnnotation, ); } @@ -356,6 +360,75 @@ class FlowParser implements Parser { getGetTypeAnnotationFN(): GetTypeAnnotationFN { return getTypeAnnotation; } + + getResolvedTypeAnnotation( + typeAnnotation: $FlowFixMe, + types: TypeDeclarationMap, + ): { + nullable: boolean, + typeAnnotation: $FlowFixMe, + typeResolutionStatus: TypeResolutionStatus, + } { + invariant( + typeAnnotation != null, + 'resolveTypeAnnotation(): typeAnnotation cannot be null', + ); + + let node = typeAnnotation; + let nullable = false; + let typeResolutionStatus: TypeResolutionStatus = { + successful: false, + }; + + for (;;) { + if (node.type === 'NullableTypeAnnotation') { + nullable = true; + node = node.typeAnnotation; + continue; + } + + if (node.type !== 'GenericTypeAnnotation') { + break; + } + + const resolvedTypeAnnotation = types[node.id.name]; + if (resolvedTypeAnnotation == null) { + break; + } + + switch (resolvedTypeAnnotation.type) { + case 'TypeAlias': { + typeResolutionStatus = { + successful: true, + type: 'alias', + name: node.id.name, + }; + node = resolvedTypeAnnotation.right; + break; + } + case 'EnumDeclaration': { + typeResolutionStatus = { + successful: true, + type: 'enum', + name: node.id.name, + }; + node = resolvedTypeAnnotation.body; + break; + } + default: { + throw new TypeError( + `A non GenericTypeAnnotation must be a type declaration ('TypeAlias') or enum ('EnumDeclaration'). Instead, got the unsupported ${resolvedTypeAnnotation.type}.`, + ); + } + } + } + + return { + nullable: nullable, + typeAnnotation: node, + typeResolutionStatus, + }; + } } module.exports = { diff --git a/packages/react-native-codegen/src/parsers/flow/utils.js b/packages/react-native-codegen/src/parsers/flow/utils.js index 258c9258512fc0..73e71760df4423 100644 --- a/packages/react-native-codegen/src/parsers/flow/utils.js +++ b/packages/react-native-codegen/src/parsers/flow/utils.js @@ -10,79 +10,7 @@ 'use strict'; -import type {TypeResolutionStatus, TypeDeclarationMap, ASTNode} from '../utils'; - -const invariant = require('invariant'); - -function resolveTypeAnnotation( - // TODO(T71778680): This is an Flow TypeAnnotation. Flow-type this - typeAnnotation: $FlowFixMe, - types: TypeDeclarationMap, -): { - nullable: boolean, - typeAnnotation: $FlowFixMe, - typeResolutionStatus: TypeResolutionStatus, -} { - invariant( - typeAnnotation != null, - 'resolveTypeAnnotation(): typeAnnotation cannot be null', - ); - - let node = typeAnnotation; - let nullable = false; - let typeResolutionStatus: TypeResolutionStatus = { - successful: false, - }; - - for (;;) { - if (node.type === 'NullableTypeAnnotation') { - nullable = true; - node = node.typeAnnotation; - continue; - } - - if (node.type !== 'GenericTypeAnnotation') { - break; - } - - const resolvedTypeAnnotation = types[node.id.name]; - if (resolvedTypeAnnotation == null) { - break; - } - - switch (resolvedTypeAnnotation.type) { - case 'TypeAlias': { - typeResolutionStatus = { - successful: true, - type: 'alias', - name: node.id.name, - }; - node = resolvedTypeAnnotation.right; - break; - } - case 'EnumDeclaration': { - typeResolutionStatus = { - successful: true, - type: 'enum', - name: node.id.name, - }; - node = resolvedTypeAnnotation.body; - break; - } - default: { - throw new TypeError( - `A non GenericTypeAnnotation must be a type declaration ('TypeAlias') or enum ('EnumDeclaration'). Instead, got the unsupported ${resolvedTypeAnnotation.type}.`, - ); - } - } - } - - return { - nullable: nullable, - typeAnnotation: node, - typeResolutionStatus, - }; -} +import type {TypeDeclarationMap, ASTNode} from '../utils'; function getValueFromTypes(value: ASTNode, types: TypeDeclarationMap): ASTNode { if (value.type === 'GenericTypeAnnotation' && types[value.id.name]) { @@ -93,5 +21,4 @@ function getValueFromTypes(value: ASTNode, types: TypeDeclarationMap): ASTNode { module.exports = { getValueFromTypes, - resolveTypeAnnotation, }; diff --git a/packages/react-native-codegen/src/parsers/parser.js b/packages/react-native-codegen/src/parsers/parser.js index b95cc3d5ad2d01..64dcffe6f45bd8 100644 --- a/packages/react-native-codegen/src/parsers/parser.js +++ b/packages/react-native-codegen/src/parsers/parser.js @@ -27,6 +27,7 @@ import type { TypeDeclarationMap, PropAST, ASTNode, + TypeResolutionStatus, } from './utils'; export type GetTypeAnnotationFN = ( @@ -318,4 +319,13 @@ export interface Parser { getGetTypeAnnotationFN(): GetTypeAnnotationFN; getGetSchemaInfoFN(): GetSchemaInfoFN; + + getResolvedTypeAnnotation( + typeAnnotation: $FlowFixMe, + types: TypeDeclarationMap, + ): { + nullable: boolean, + typeAnnotation: $FlowFixMe, + typeResolutionStatus: TypeResolutionStatus, + }; } diff --git a/packages/react-native-codegen/src/parsers/parserMock.js b/packages/react-native-codegen/src/parsers/parserMock.js index 4dbb5246c24102..8800d328988860 100644 --- a/packages/react-native-codegen/src/parsers/parserMock.js +++ b/packages/react-native-codegen/src/parsers/parserMock.js @@ -23,7 +23,13 @@ import type { NativeModuleAliasMap, NativeModuleEnumMap, } from '../CodegenSchema'; -import type {ParserErrorCapturer, PropAST, TypeDeclarationMap} from './utils'; +import type { + ParserErrorCapturer, + PropAST, + TypeDeclarationMap, + TypeResolutionStatus, +} from './utils'; +import invariant from 'invariant'; // $FlowFixMe[untyped-import] there's no flowtype flow-parser const flowParser = require('flow-parser'); @@ -273,4 +279,73 @@ export class MockedParser implements Parser { }; }; } + + getResolvedTypeAnnotation( + typeAnnotation: $FlowFixMe, + types: TypeDeclarationMap, + ): { + nullable: boolean, + typeAnnotation: $FlowFixMe, + typeResolutionStatus: TypeResolutionStatus, + } { + invariant( + typeAnnotation != null, + 'resolveTypeAnnotation(): typeAnnotation cannot be null', + ); + + let node = typeAnnotation; + let nullable = false; + let typeResolutionStatus: TypeResolutionStatus = { + successful: false, + }; + + for (;;) { + if (node.type === 'NullableTypeAnnotation') { + nullable = true; + node = node.typeAnnotation; + continue; + } + + if (node.type !== 'GenericTypeAnnotation') { + break; + } + + const resolvedTypeAnnotation = types[node.id.name]; + if (resolvedTypeAnnotation == null) { + break; + } + + switch (resolvedTypeAnnotation.type) { + case 'TypeAlias': { + typeResolutionStatus = { + successful: true, + type: 'alias', + name: node.id.name, + }; + node = resolvedTypeAnnotation.right; + break; + } + case 'EnumDeclaration': { + typeResolutionStatus = { + successful: true, + type: 'enum', + name: node.id.name, + }; + node = resolvedTypeAnnotation.body; + break; + } + default: { + throw new TypeError( + `A non GenericTypeAnnotation must be a type declaration ('TypeAlias') or enum ('EnumDeclaration'). Instead, got the unsupported ${resolvedTypeAnnotation.type}.`, + ); + } + } + } + + return { + nullable: nullable, + typeAnnotation: node, + typeResolutionStatus, + }; + } } diff --git a/packages/react-native-codegen/src/parsers/parsers-commons.js b/packages/react-native-codegen/src/parsers/parsers-commons.js index 0b9f06c36cb060..425c99fd063d07 100644 --- a/packages/react-native-codegen/src/parsers/parsers-commons.js +++ b/packages/react-native-codegen/src/parsers/parsers-commons.js @@ -322,7 +322,6 @@ function buildPropertySchema( enumMap: {...NativeModuleEnumMap}, tryParse: ParserErrorCapturer, cxxOnly: boolean, - resolveTypeAnnotation: $FlowFixMe, translateTypeAnnotation: $FlowFixMe, parser: Parser, ): NativeModulePropertyShape { @@ -337,7 +336,10 @@ function buildPropertySchema( : property.typeAnnotation; } - ({nullable, typeAnnotation: value} = resolveTypeAnnotation(value, types)); + ({nullable, typeAnnotation: value} = parser.getResolvedTypeAnnotation( + value, + types, + )); throwIfModuleTypeIsUnsupported( hasteModuleName, @@ -381,11 +383,9 @@ function buildSchemaFromConfigType( ast: $FlowFixMe, tryParse: ParserErrorCapturer, parser: Parser, - resolveTypeAnnotation: $FlowFixMe, translateTypeAnnotation: $FlowFixMe, ) => NativeModuleSchema, parser: Parser, - resolveTypeAnnotation: $FlowFixMe, translateTypeAnnotation: $FlowFixMe, ): SchemaType { switch (configType) { @@ -406,7 +406,6 @@ function buildSchemaFromConfigType( ast, tryParse, parser, - resolveTypeAnnotation, translateTypeAnnotation, ), ); @@ -448,14 +447,12 @@ function buildSchema( ast: $FlowFixMe, tryParse: ParserErrorCapturer, parser: Parser, - resolveTypeAnnotation: $FlowFixMe, translateTypeAnnotation: $FlowFixMe, ) => NativeModuleSchema, Visitor: ({isComponent: boolean, isModule: boolean}) => { [type: string]: (node: $FlowFixMe) => void, }, parser: Parser, - resolveTypeAnnotation: $FlowFixMe, translateTypeAnnotation: $FlowFixMe, ): SchemaType { // Early return for non-Spec JavaScript files @@ -477,7 +474,6 @@ function buildSchema( buildComponentSchema, buildModuleSchema, parser, - resolveTypeAnnotation, translateTypeAnnotation, ); } @@ -572,7 +568,6 @@ const buildModuleSchema = ( ast: $FlowFixMe, tryParse: ParserErrorCapturer, parser: Parser, - resolveTypeAnnotation: $FlowFixMe, translateTypeAnnotation: $FlowFixMe, ): NativeModuleSchema => { const language = parser.language(); @@ -640,7 +635,6 @@ const buildModuleSchema = ( enumMap, tryParse, cxxOnly, - resolveTypeAnnotation, translateTypeAnnotation, parser, ), diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/index.js b/packages/react-native-codegen/src/parsers/typescript/modules/index.js index 6123cf4321a736..1defa0347a96d3 100644 --- a/packages/react-native-codegen/src/parsers/typescript/modules/index.js +++ b/packages/react-native-codegen/src/parsers/typescript/modules/index.js @@ -28,8 +28,6 @@ import type { const {flattenIntersectionType} = require('../parseTopLevelType'); const {flattenProperties} = require('../components/componentsUtils'); -const {resolveTypeAnnotation} = require('../utils'); - const {parseObjectProperty} = require('../../parsers-commons'); const { @@ -190,7 +188,7 @@ function translateTypeAnnotation( parser: Parser, ): Nullable { const {nullable, typeAnnotation, typeResolutionStatus} = - resolveTypeAnnotation(typeScriptTypeAnnotation, types); + parser.getResolvedTypeAnnotation(typeScriptTypeAnnotation, types); switch (typeAnnotation.type) { case 'TSArrayType': { diff --git a/packages/react-native-codegen/src/parsers/typescript/parser.js b/packages/react-native-codegen/src/parsers/typescript/parser.js index a467dc919005df..05bd918005e9a1 100644 --- a/packages/react-native-codegen/src/parsers/typescript/parser.js +++ b/packages/react-native-codegen/src/parsers/typescript/parser.js @@ -23,7 +23,13 @@ import type { } from '../../CodegenSchema'; import type {ParserType} from '../errors'; import type {GetSchemaInfoFN, GetTypeAnnotationFN, Parser} from '../parser'; -import type {ParserErrorCapturer, TypeDeclarationMap, PropAST} from '../utils'; +import type { + ParserErrorCapturer, + TypeDeclarationMap, + PropAST, + TypeResolutionStatus, +} from '../utils'; +const invariant = require('invariant'); const {typeScriptTranslateTypeAnnotation} = require('./modules'); @@ -35,7 +41,7 @@ const {Visitor} = require('../parsers-primitives'); const {buildComponentSchema} = require('./components'); const {wrapComponentSchema} = require('../schema.js'); const {buildModuleSchema} = require('../parsers-commons.js'); -const {resolveTypeAnnotation} = require('./utils'); +const {parseTopLevelType} = require('./parseTopLevelType'); const { getSchemaInfo, getTypeAnnotation, @@ -112,7 +118,6 @@ class TypeScriptParser implements Parser { buildModuleSchema, Visitor, this, - resolveTypeAnnotation, typeScriptTranslateTypeAnnotation, ); } @@ -352,6 +357,86 @@ class TypeScriptParser implements Parser { getGetTypeAnnotationFN(): GetTypeAnnotationFN { return getTypeAnnotation; } + + getResolvedTypeAnnotation( + // TODO(T108222691): Use flow-types for @babel/parser + typeAnnotation: $FlowFixMe, + types: TypeDeclarationMap, + ): { + nullable: boolean, + typeAnnotation: $FlowFixMe, + typeResolutionStatus: TypeResolutionStatus, + } { + invariant( + typeAnnotation != null, + 'resolveTypeAnnotation(): typeAnnotation cannot be null', + ); + + let node = + typeAnnotation.type === 'TSTypeAnnotation' + ? typeAnnotation.typeAnnotation + : typeAnnotation; + let nullable = false; + let typeResolutionStatus: TypeResolutionStatus = { + successful: false, + }; + + for (;;) { + const topLevelType = parseTopLevelType(node); + nullable = nullable || topLevelType.optional; + node = topLevelType.type; + + if (node.type !== 'TSTypeReference') { + break; + } + + const resolvedTypeAnnotation = types[node.typeName.name]; + if (resolvedTypeAnnotation == null) { + break; + } + + switch (resolvedTypeAnnotation.type) { + case 'TSTypeAliasDeclaration': { + typeResolutionStatus = { + successful: true, + type: 'alias', + name: node.typeName.name, + }; + node = resolvedTypeAnnotation.typeAnnotation; + break; + } + case 'TSInterfaceDeclaration': { + typeResolutionStatus = { + successful: true, + type: 'alias', + name: node.typeName.name, + }; + node = resolvedTypeAnnotation; + break; + } + case 'TSEnumDeclaration': { + typeResolutionStatus = { + successful: true, + type: 'enum', + name: node.typeName.name, + }; + node = resolvedTypeAnnotation; + break; + } + default: { + throw new TypeError( + `A non GenericTypeAnnotation must be a type declaration ('TSTypeAliasDeclaration'), an interface ('TSInterfaceDeclaration'), or enum ('TSEnumDeclaration'). Instead, got the unsupported ${resolvedTypeAnnotation.type}.`, + ); + } + } + } + + return { + nullable: nullable, + typeAnnotation: node, + typeResolutionStatus, + }; + } } module.exports = { diff --git a/packages/react-native-codegen/src/parsers/typescript/utils.js b/packages/react-native-codegen/src/parsers/typescript/utils.js index e555ff5fe4e2c4..5fe88cd8b288b4 100644 --- a/packages/react-native-codegen/src/parsers/typescript/utils.js +++ b/packages/react-native-codegen/src/parsers/typescript/utils.js @@ -10,92 +10,5 @@ 'use strict'; -import type {TypeResolutionStatus, TypeDeclarationMap} from '../utils'; - -const {parseTopLevelType} = require('./parseTopLevelType'); - -const invariant = require('invariant'); - -function resolveTypeAnnotation( - // TODO(T108222691): Use flow-types for @babel/parser - typeAnnotation: $FlowFixMe, - types: TypeDeclarationMap, -): { - nullable: boolean, - typeAnnotation: $FlowFixMe, - typeResolutionStatus: TypeResolutionStatus, -} { - invariant( - typeAnnotation != null, - 'resolveTypeAnnotation(): typeAnnotation cannot be null', - ); - - let node = - typeAnnotation.type === 'TSTypeAnnotation' - ? typeAnnotation.typeAnnotation - : typeAnnotation; - let nullable = false; - let typeResolutionStatus: TypeResolutionStatus = { - successful: false, - }; - - for (;;) { - const topLevelType = parseTopLevelType(node); - nullable = nullable || topLevelType.optional; - node = topLevelType.type; - - if (node.type !== 'TSTypeReference') { - break; - } - - const resolvedTypeAnnotation = types[node.typeName.name]; - if (resolvedTypeAnnotation == null) { - break; - } - - switch (resolvedTypeAnnotation.type) { - case 'TSTypeAliasDeclaration': { - typeResolutionStatus = { - successful: true, - type: 'alias', - name: node.typeName.name, - }; - node = resolvedTypeAnnotation.typeAnnotation; - break; - } - case 'TSInterfaceDeclaration': { - typeResolutionStatus = { - successful: true, - type: 'alias', - name: node.typeName.name, - }; - node = resolvedTypeAnnotation; - break; - } - case 'TSEnumDeclaration': { - typeResolutionStatus = { - successful: true, - type: 'enum', - name: node.typeName.name, - }; - node = resolvedTypeAnnotation; - break; - } - default: { - throw new TypeError( - `A non GenericTypeAnnotation must be a type declaration ('TSTypeAliasDeclaration'), an interface ('TSInterfaceDeclaration'), or enum ('TSEnumDeclaration'). Instead, got the unsupported ${resolvedTypeAnnotation.type}.`, - ); - } - } - } - - return { - nullable: nullable, - typeAnnotation: node, - typeResolutionStatus, - }; -} - -module.exports = { - resolveTypeAnnotation, -}; +// $FlowFixMe[unclear-type] Use flow-types for @babel/parser +export type ASTNode = Object;