ab9d723cc1a4cb8a890ab2b590b6043bf67d9de82bfdb9d4637712066909f1e05f5f2cee3a241423d1be9fe89e0e7c768edac0031ff33950fed6f6e9bd4a08 83 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.anyTypeAnnotation = anyTypeAnnotation;
  6. exports.argumentPlaceholder = argumentPlaceholder;
  7. exports.arrayExpression = arrayExpression;
  8. exports.arrayPattern = arrayPattern;
  9. exports.arrayTypeAnnotation = arrayTypeAnnotation;
  10. exports.arrowFunctionExpression = arrowFunctionExpression;
  11. exports.assignmentExpression = assignmentExpression;
  12. exports.assignmentPattern = assignmentPattern;
  13. exports.awaitExpression = awaitExpression;
  14. exports.bigIntLiteral = bigIntLiteral;
  15. exports.binaryExpression = binaryExpression;
  16. exports.bindExpression = bindExpression;
  17. exports.blockStatement = blockStatement;
  18. exports.booleanLiteral = booleanLiteral;
  19. exports.booleanLiteralTypeAnnotation = booleanLiteralTypeAnnotation;
  20. exports.booleanTypeAnnotation = booleanTypeAnnotation;
  21. exports.breakStatement = breakStatement;
  22. exports.callExpression = callExpression;
  23. exports.catchClause = catchClause;
  24. exports.classAccessorProperty = classAccessorProperty;
  25. exports.classBody = classBody;
  26. exports.classDeclaration = classDeclaration;
  27. exports.classExpression = classExpression;
  28. exports.classImplements = classImplements;
  29. exports.classMethod = classMethod;
  30. exports.classPrivateMethod = classPrivateMethod;
  31. exports.classPrivateProperty = classPrivateProperty;
  32. exports.classProperty = classProperty;
  33. exports.conditionalExpression = conditionalExpression;
  34. exports.continueStatement = continueStatement;
  35. exports.debuggerStatement = debuggerStatement;
  36. exports.decimalLiteral = decimalLiteral;
  37. exports.declareClass = declareClass;
  38. exports.declareExportAllDeclaration = declareExportAllDeclaration;
  39. exports.declareExportDeclaration = declareExportDeclaration;
  40. exports.declareFunction = declareFunction;
  41. exports.declareInterface = declareInterface;
  42. exports.declareModule = declareModule;
  43. exports.declareModuleExports = declareModuleExports;
  44. exports.declareOpaqueType = declareOpaqueType;
  45. exports.declareTypeAlias = declareTypeAlias;
  46. exports.declareVariable = declareVariable;
  47. exports.declaredPredicate = declaredPredicate;
  48. exports.decorator = decorator;
  49. exports.directive = directive;
  50. exports.directiveLiteral = directiveLiteral;
  51. exports.doExpression = doExpression;
  52. exports.doWhileStatement = doWhileStatement;
  53. exports.emptyStatement = emptyStatement;
  54. exports.emptyTypeAnnotation = emptyTypeAnnotation;
  55. exports.enumBooleanBody = enumBooleanBody;
  56. exports.enumBooleanMember = enumBooleanMember;
  57. exports.enumDeclaration = enumDeclaration;
  58. exports.enumDefaultedMember = enumDefaultedMember;
  59. exports.enumNumberBody = enumNumberBody;
  60. exports.enumNumberMember = enumNumberMember;
  61. exports.enumStringBody = enumStringBody;
  62. exports.enumStringMember = enumStringMember;
  63. exports.enumSymbolBody = enumSymbolBody;
  64. exports.existsTypeAnnotation = existsTypeAnnotation;
  65. exports.exportAllDeclaration = exportAllDeclaration;
  66. exports.exportDefaultDeclaration = exportDefaultDeclaration;
  67. exports.exportDefaultSpecifier = exportDefaultSpecifier;
  68. exports.exportNamedDeclaration = exportNamedDeclaration;
  69. exports.exportNamespaceSpecifier = exportNamespaceSpecifier;
  70. exports.exportSpecifier = exportSpecifier;
  71. exports.expressionStatement = expressionStatement;
  72. exports.file = file;
  73. exports.forInStatement = forInStatement;
  74. exports.forOfStatement = forOfStatement;
  75. exports.forStatement = forStatement;
  76. exports.functionDeclaration = functionDeclaration;
  77. exports.functionExpression = functionExpression;
  78. exports.functionTypeAnnotation = functionTypeAnnotation;
  79. exports.functionTypeParam = functionTypeParam;
  80. exports.genericTypeAnnotation = genericTypeAnnotation;
  81. exports.identifier = identifier;
  82. exports.ifStatement = ifStatement;
  83. exports.import = _import;
  84. exports.importAttribute = importAttribute;
  85. exports.importDeclaration = importDeclaration;
  86. exports.importDefaultSpecifier = importDefaultSpecifier;
  87. exports.importExpression = importExpression;
  88. exports.importNamespaceSpecifier = importNamespaceSpecifier;
  89. exports.importSpecifier = importSpecifier;
  90. exports.indexedAccessType = indexedAccessType;
  91. exports.inferredPredicate = inferredPredicate;
  92. exports.interfaceDeclaration = interfaceDeclaration;
  93. exports.interfaceExtends = interfaceExtends;
  94. exports.interfaceTypeAnnotation = interfaceTypeAnnotation;
  95. exports.interpreterDirective = interpreterDirective;
  96. exports.intersectionTypeAnnotation = intersectionTypeAnnotation;
  97. exports.jSXAttribute = exports.jsxAttribute = jsxAttribute;
  98. exports.jSXClosingElement = exports.jsxClosingElement = jsxClosingElement;
  99. exports.jSXClosingFragment = exports.jsxClosingFragment = jsxClosingFragment;
  100. exports.jSXElement = exports.jsxElement = jsxElement;
  101. exports.jSXEmptyExpression = exports.jsxEmptyExpression = jsxEmptyExpression;
  102. exports.jSXExpressionContainer = exports.jsxExpressionContainer = jsxExpressionContainer;
  103. exports.jSXFragment = exports.jsxFragment = jsxFragment;
  104. exports.jSXIdentifier = exports.jsxIdentifier = jsxIdentifier;
  105. exports.jSXMemberExpression = exports.jsxMemberExpression = jsxMemberExpression;
  106. exports.jSXNamespacedName = exports.jsxNamespacedName = jsxNamespacedName;
  107. exports.jSXOpeningElement = exports.jsxOpeningElement = jsxOpeningElement;
  108. exports.jSXOpeningFragment = exports.jsxOpeningFragment = jsxOpeningFragment;
  109. exports.jSXSpreadAttribute = exports.jsxSpreadAttribute = jsxSpreadAttribute;
  110. exports.jSXSpreadChild = exports.jsxSpreadChild = jsxSpreadChild;
  111. exports.jSXText = exports.jsxText = jsxText;
  112. exports.labeledStatement = labeledStatement;
  113. exports.logicalExpression = logicalExpression;
  114. exports.memberExpression = memberExpression;
  115. exports.metaProperty = metaProperty;
  116. exports.mixedTypeAnnotation = mixedTypeAnnotation;
  117. exports.moduleExpression = moduleExpression;
  118. exports.newExpression = newExpression;
  119. exports.noop = noop;
  120. exports.nullLiteral = nullLiteral;
  121. exports.nullLiteralTypeAnnotation = nullLiteralTypeAnnotation;
  122. exports.nullableTypeAnnotation = nullableTypeAnnotation;
  123. exports.numberLiteral = NumberLiteral;
  124. exports.numberLiteralTypeAnnotation = numberLiteralTypeAnnotation;
  125. exports.numberTypeAnnotation = numberTypeAnnotation;
  126. exports.numericLiteral = numericLiteral;
  127. exports.objectExpression = objectExpression;
  128. exports.objectMethod = objectMethod;
  129. exports.objectPattern = objectPattern;
  130. exports.objectProperty = objectProperty;
  131. exports.objectTypeAnnotation = objectTypeAnnotation;
  132. exports.objectTypeCallProperty = objectTypeCallProperty;
  133. exports.objectTypeIndexer = objectTypeIndexer;
  134. exports.objectTypeInternalSlot = objectTypeInternalSlot;
  135. exports.objectTypeProperty = objectTypeProperty;
  136. exports.objectTypeSpreadProperty = objectTypeSpreadProperty;
  137. exports.opaqueType = opaqueType;
  138. exports.optionalCallExpression = optionalCallExpression;
  139. exports.optionalIndexedAccessType = optionalIndexedAccessType;
  140. exports.optionalMemberExpression = optionalMemberExpression;
  141. exports.parenthesizedExpression = parenthesizedExpression;
  142. exports.pipelineBareFunction = pipelineBareFunction;
  143. exports.pipelinePrimaryTopicReference = pipelinePrimaryTopicReference;
  144. exports.pipelineTopicExpression = pipelineTopicExpression;
  145. exports.placeholder = placeholder;
  146. exports.privateName = privateName;
  147. exports.program = program;
  148. exports.qualifiedTypeIdentifier = qualifiedTypeIdentifier;
  149. exports.recordExpression = recordExpression;
  150. exports.regExpLiteral = regExpLiteral;
  151. exports.regexLiteral = RegexLiteral;
  152. exports.restElement = restElement;
  153. exports.restProperty = RestProperty;
  154. exports.returnStatement = returnStatement;
  155. exports.sequenceExpression = sequenceExpression;
  156. exports.spreadElement = spreadElement;
  157. exports.spreadProperty = SpreadProperty;
  158. exports.staticBlock = staticBlock;
  159. exports.stringLiteral = stringLiteral;
  160. exports.stringLiteralTypeAnnotation = stringLiteralTypeAnnotation;
  161. exports.stringTypeAnnotation = stringTypeAnnotation;
  162. exports.super = _super;
  163. exports.switchCase = switchCase;
  164. exports.switchStatement = switchStatement;
  165. exports.symbolTypeAnnotation = symbolTypeAnnotation;
  166. exports.taggedTemplateExpression = taggedTemplateExpression;
  167. exports.templateElement = templateElement;
  168. exports.templateLiteral = templateLiteral;
  169. exports.thisExpression = thisExpression;
  170. exports.thisTypeAnnotation = thisTypeAnnotation;
  171. exports.throwStatement = throwStatement;
  172. exports.topicReference = topicReference;
  173. exports.tryStatement = tryStatement;
  174. exports.tSAnyKeyword = exports.tsAnyKeyword = tsAnyKeyword;
  175. exports.tSArrayType = exports.tsArrayType = tsArrayType;
  176. exports.tSAsExpression = exports.tsAsExpression = tsAsExpression;
  177. exports.tSBigIntKeyword = exports.tsBigIntKeyword = tsBigIntKeyword;
  178. exports.tSBooleanKeyword = exports.tsBooleanKeyword = tsBooleanKeyword;
  179. exports.tSCallSignatureDeclaration = exports.tsCallSignatureDeclaration = tsCallSignatureDeclaration;
  180. exports.tSConditionalType = exports.tsConditionalType = tsConditionalType;
  181. exports.tSConstructSignatureDeclaration = exports.tsConstructSignatureDeclaration = tsConstructSignatureDeclaration;
  182. exports.tSConstructorType = exports.tsConstructorType = tsConstructorType;
  183. exports.tSDeclareFunction = exports.tsDeclareFunction = tsDeclareFunction;
  184. exports.tSDeclareMethod = exports.tsDeclareMethod = tsDeclareMethod;
  185. exports.tSEnumBody = exports.tsEnumBody = tsEnumBody;
  186. exports.tSEnumDeclaration = exports.tsEnumDeclaration = tsEnumDeclaration;
  187. exports.tSEnumMember = exports.tsEnumMember = tsEnumMember;
  188. exports.tSExportAssignment = exports.tsExportAssignment = tsExportAssignment;
  189. exports.tSExpressionWithTypeArguments = exports.tsExpressionWithTypeArguments = tsExpressionWithTypeArguments;
  190. exports.tSExternalModuleReference = exports.tsExternalModuleReference = tsExternalModuleReference;
  191. exports.tSFunctionType = exports.tsFunctionType = tsFunctionType;
  192. exports.tSImportEqualsDeclaration = exports.tsImportEqualsDeclaration = tsImportEqualsDeclaration;
  193. exports.tSImportType = exports.tsImportType = tsImportType;
  194. exports.tSIndexSignature = exports.tsIndexSignature = tsIndexSignature;
  195. exports.tSIndexedAccessType = exports.tsIndexedAccessType = tsIndexedAccessType;
  196. exports.tSInferType = exports.tsInferType = tsInferType;
  197. exports.tSInstantiationExpression = exports.tsInstantiationExpression = tsInstantiationExpression;
  198. exports.tSInterfaceBody = exports.tsInterfaceBody = tsInterfaceBody;
  199. exports.tSInterfaceDeclaration = exports.tsInterfaceDeclaration = tsInterfaceDeclaration;
  200. exports.tSIntersectionType = exports.tsIntersectionType = tsIntersectionType;
  201. exports.tSIntrinsicKeyword = exports.tsIntrinsicKeyword = tsIntrinsicKeyword;
  202. exports.tSLiteralType = exports.tsLiteralType = tsLiteralType;
  203. exports.tSMappedType = exports.tsMappedType = tsMappedType;
  204. exports.tSMethodSignature = exports.tsMethodSignature = tsMethodSignature;
  205. exports.tSModuleBlock = exports.tsModuleBlock = tsModuleBlock;
  206. exports.tSModuleDeclaration = exports.tsModuleDeclaration = tsModuleDeclaration;
  207. exports.tSNamedTupleMember = exports.tsNamedTupleMember = tsNamedTupleMember;
  208. exports.tSNamespaceExportDeclaration = exports.tsNamespaceExportDeclaration = tsNamespaceExportDeclaration;
  209. exports.tSNeverKeyword = exports.tsNeverKeyword = tsNeverKeyword;
  210. exports.tSNonNullExpression = exports.tsNonNullExpression = tsNonNullExpression;
  211. exports.tSNullKeyword = exports.tsNullKeyword = tsNullKeyword;
  212. exports.tSNumberKeyword = exports.tsNumberKeyword = tsNumberKeyword;
  213. exports.tSObjectKeyword = exports.tsObjectKeyword = tsObjectKeyword;
  214. exports.tSOptionalType = exports.tsOptionalType = tsOptionalType;
  215. exports.tSParameterProperty = exports.tsParameterProperty = tsParameterProperty;
  216. exports.tSParenthesizedType = exports.tsParenthesizedType = tsParenthesizedType;
  217. exports.tSPropertySignature = exports.tsPropertySignature = tsPropertySignature;
  218. exports.tSQualifiedName = exports.tsQualifiedName = tsQualifiedName;
  219. exports.tSRestType = exports.tsRestType = tsRestType;
  220. exports.tSSatisfiesExpression = exports.tsSatisfiesExpression = tsSatisfiesExpression;
  221. exports.tSStringKeyword = exports.tsStringKeyword = tsStringKeyword;
  222. exports.tSSymbolKeyword = exports.tsSymbolKeyword = tsSymbolKeyword;
  223. exports.tSTemplateLiteralType = exports.tsTemplateLiteralType = tsTemplateLiteralType;
  224. exports.tSThisType = exports.tsThisType = tsThisType;
  225. exports.tSTupleType = exports.tsTupleType = tsTupleType;
  226. exports.tSTypeAliasDeclaration = exports.tsTypeAliasDeclaration = tsTypeAliasDeclaration;
  227. exports.tSTypeAnnotation = exports.tsTypeAnnotation = tsTypeAnnotation;
  228. exports.tSTypeAssertion = exports.tsTypeAssertion = tsTypeAssertion;
  229. exports.tSTypeLiteral = exports.tsTypeLiteral = tsTypeLiteral;
  230. exports.tSTypeOperator = exports.tsTypeOperator = tsTypeOperator;
  231. exports.tSTypeParameter = exports.tsTypeParameter = tsTypeParameter;
  232. exports.tSTypeParameterDeclaration = exports.tsTypeParameterDeclaration = tsTypeParameterDeclaration;
  233. exports.tSTypeParameterInstantiation = exports.tsTypeParameterInstantiation = tsTypeParameterInstantiation;
  234. exports.tSTypePredicate = exports.tsTypePredicate = tsTypePredicate;
  235. exports.tSTypeQuery = exports.tsTypeQuery = tsTypeQuery;
  236. exports.tSTypeReference = exports.tsTypeReference = tsTypeReference;
  237. exports.tSUndefinedKeyword = exports.tsUndefinedKeyword = tsUndefinedKeyword;
  238. exports.tSUnionType = exports.tsUnionType = tsUnionType;
  239. exports.tSUnknownKeyword = exports.tsUnknownKeyword = tsUnknownKeyword;
  240. exports.tSVoidKeyword = exports.tsVoidKeyword = tsVoidKeyword;
  241. exports.tupleExpression = tupleExpression;
  242. exports.tupleTypeAnnotation = tupleTypeAnnotation;
  243. exports.typeAlias = typeAlias;
  244. exports.typeAnnotation = typeAnnotation;
  245. exports.typeCastExpression = typeCastExpression;
  246. exports.typeParameter = typeParameter;
  247. exports.typeParameterDeclaration = typeParameterDeclaration;
  248. exports.typeParameterInstantiation = typeParameterInstantiation;
  249. exports.typeofTypeAnnotation = typeofTypeAnnotation;
  250. exports.unaryExpression = unaryExpression;
  251. exports.unionTypeAnnotation = unionTypeAnnotation;
  252. exports.updateExpression = updateExpression;
  253. exports.v8IntrinsicIdentifier = v8IntrinsicIdentifier;
  254. exports.variableDeclaration = variableDeclaration;
  255. exports.variableDeclarator = variableDeclarator;
  256. exports.variance = variance;
  257. exports.voidTypeAnnotation = voidTypeAnnotation;
  258. exports.whileStatement = whileStatement;
  259. exports.withStatement = withStatement;
  260. exports.yieldExpression = yieldExpression;
  261. var _validate = require("../../validators/validate.js");
  262. var _deprecationWarning = require("../../utils/deprecationWarning.js");
  263. var utils = require("../../definitions/utils.js");
  264. const {
  265. validateInternal: validate
  266. } = _validate;
  267. const {
  268. NODE_FIELDS
  269. } = utils;
  270. function arrayExpression(elements = []) {
  271. const node = {
  272. type: "ArrayExpression",
  273. elements
  274. };
  275. const defs = NODE_FIELDS.ArrayExpression;
  276. validate(defs.elements, node, "elements", elements, 1);
  277. return node;
  278. }
  279. function assignmentExpression(operator, left, right) {
  280. const node = {
  281. type: "AssignmentExpression",
  282. operator,
  283. left,
  284. right
  285. };
  286. const defs = NODE_FIELDS.AssignmentExpression;
  287. validate(defs.operator, node, "operator", operator);
  288. validate(defs.left, node, "left", left, 1);
  289. validate(defs.right, node, "right", right, 1);
  290. return node;
  291. }
  292. function binaryExpression(operator, left, right) {
  293. const node = {
  294. type: "BinaryExpression",
  295. operator,
  296. left,
  297. right
  298. };
  299. const defs = NODE_FIELDS.BinaryExpression;
  300. validate(defs.operator, node, "operator", operator);
  301. validate(defs.left, node, "left", left, 1);
  302. validate(defs.right, node, "right", right, 1);
  303. return node;
  304. }
  305. function interpreterDirective(value) {
  306. const node = {
  307. type: "InterpreterDirective",
  308. value
  309. };
  310. const defs = NODE_FIELDS.InterpreterDirective;
  311. validate(defs.value, node, "value", value);
  312. return node;
  313. }
  314. function directive(value) {
  315. const node = {
  316. type: "Directive",
  317. value
  318. };
  319. const defs = NODE_FIELDS.Directive;
  320. validate(defs.value, node, "value", value, 1);
  321. return node;
  322. }
  323. function directiveLiteral(value) {
  324. const node = {
  325. type: "DirectiveLiteral",
  326. value
  327. };
  328. const defs = NODE_FIELDS.DirectiveLiteral;
  329. validate(defs.value, node, "value", value);
  330. return node;
  331. }
  332. function blockStatement(body, directives = []) {
  333. const node = {
  334. type: "BlockStatement",
  335. body,
  336. directives
  337. };
  338. const defs = NODE_FIELDS.BlockStatement;
  339. validate(defs.body, node, "body", body, 1);
  340. validate(defs.directives, node, "directives", directives, 1);
  341. return node;
  342. }
  343. function breakStatement(label = null) {
  344. const node = {
  345. type: "BreakStatement",
  346. label
  347. };
  348. const defs = NODE_FIELDS.BreakStatement;
  349. validate(defs.label, node, "label", label, 1);
  350. return node;
  351. }
  352. function callExpression(callee, _arguments) {
  353. const node = {
  354. type: "CallExpression",
  355. callee,
  356. arguments: _arguments
  357. };
  358. const defs = NODE_FIELDS.CallExpression;
  359. validate(defs.callee, node, "callee", callee, 1);
  360. validate(defs.arguments, node, "arguments", _arguments, 1);
  361. return node;
  362. }
  363. function catchClause(param = null, body) {
  364. const node = {
  365. type: "CatchClause",
  366. param,
  367. body
  368. };
  369. const defs = NODE_FIELDS.CatchClause;
  370. validate(defs.param, node, "param", param, 1);
  371. validate(defs.body, node, "body", body, 1);
  372. return node;
  373. }
  374. function conditionalExpression(test, consequent, alternate) {
  375. const node = {
  376. type: "ConditionalExpression",
  377. test,
  378. consequent,
  379. alternate
  380. };
  381. const defs = NODE_FIELDS.ConditionalExpression;
  382. validate(defs.test, node, "test", test, 1);
  383. validate(defs.consequent, node, "consequent", consequent, 1);
  384. validate(defs.alternate, node, "alternate", alternate, 1);
  385. return node;
  386. }
  387. function continueStatement(label = null) {
  388. const node = {
  389. type: "ContinueStatement",
  390. label
  391. };
  392. const defs = NODE_FIELDS.ContinueStatement;
  393. validate(defs.label, node, "label", label, 1);
  394. return node;
  395. }
  396. function debuggerStatement() {
  397. return {
  398. type: "DebuggerStatement"
  399. };
  400. }
  401. function doWhileStatement(test, body) {
  402. const node = {
  403. type: "DoWhileStatement",
  404. test,
  405. body
  406. };
  407. const defs = NODE_FIELDS.DoWhileStatement;
  408. validate(defs.test, node, "test", test, 1);
  409. validate(defs.body, node, "body", body, 1);
  410. return node;
  411. }
  412. function emptyStatement() {
  413. return {
  414. type: "EmptyStatement"
  415. };
  416. }
  417. function expressionStatement(expression) {
  418. const node = {
  419. type: "ExpressionStatement",
  420. expression
  421. };
  422. const defs = NODE_FIELDS.ExpressionStatement;
  423. validate(defs.expression, node, "expression", expression, 1);
  424. return node;
  425. }
  426. function file(program, comments = null, tokens = null) {
  427. const node = {
  428. type: "File",
  429. program,
  430. comments,
  431. tokens
  432. };
  433. const defs = NODE_FIELDS.File;
  434. validate(defs.program, node, "program", program, 1);
  435. validate(defs.comments, node, "comments", comments, 1);
  436. validate(defs.tokens, node, "tokens", tokens);
  437. return node;
  438. }
  439. function forInStatement(left, right, body) {
  440. const node = {
  441. type: "ForInStatement",
  442. left,
  443. right,
  444. body
  445. };
  446. const defs = NODE_FIELDS.ForInStatement;
  447. validate(defs.left, node, "left", left, 1);
  448. validate(defs.right, node, "right", right, 1);
  449. validate(defs.body, node, "body", body, 1);
  450. return node;
  451. }
  452. function forStatement(init = null, test = null, update = null, body) {
  453. const node = {
  454. type: "ForStatement",
  455. init,
  456. test,
  457. update,
  458. body
  459. };
  460. const defs = NODE_FIELDS.ForStatement;
  461. validate(defs.init, node, "init", init, 1);
  462. validate(defs.test, node, "test", test, 1);
  463. validate(defs.update, node, "update", update, 1);
  464. validate(defs.body, node, "body", body, 1);
  465. return node;
  466. }
  467. function functionDeclaration(id = null, params, body, generator = false, async = false) {
  468. const node = {
  469. type: "FunctionDeclaration",
  470. id,
  471. params,
  472. body,
  473. generator,
  474. async
  475. };
  476. const defs = NODE_FIELDS.FunctionDeclaration;
  477. validate(defs.id, node, "id", id, 1);
  478. validate(defs.params, node, "params", params, 1);
  479. validate(defs.body, node, "body", body, 1);
  480. validate(defs.generator, node, "generator", generator);
  481. validate(defs.async, node, "async", async);
  482. return node;
  483. }
  484. function functionExpression(id = null, params, body, generator = false, async = false) {
  485. const node = {
  486. type: "FunctionExpression",
  487. id,
  488. params,
  489. body,
  490. generator,
  491. async
  492. };
  493. const defs = NODE_FIELDS.FunctionExpression;
  494. validate(defs.id, node, "id", id, 1);
  495. validate(defs.params, node, "params", params, 1);
  496. validate(defs.body, node, "body", body, 1);
  497. validate(defs.generator, node, "generator", generator);
  498. validate(defs.async, node, "async", async);
  499. return node;
  500. }
  501. function identifier(name) {
  502. const node = {
  503. type: "Identifier",
  504. name
  505. };
  506. const defs = NODE_FIELDS.Identifier;
  507. validate(defs.name, node, "name", name);
  508. return node;
  509. }
  510. function ifStatement(test, consequent, alternate = null) {
  511. const node = {
  512. type: "IfStatement",
  513. test,
  514. consequent,
  515. alternate
  516. };
  517. const defs = NODE_FIELDS.IfStatement;
  518. validate(defs.test, node, "test", test, 1);
  519. validate(defs.consequent, node, "consequent", consequent, 1);
  520. validate(defs.alternate, node, "alternate", alternate, 1);
  521. return node;
  522. }
  523. function labeledStatement(label, body) {
  524. const node = {
  525. type: "LabeledStatement",
  526. label,
  527. body
  528. };
  529. const defs = NODE_FIELDS.LabeledStatement;
  530. validate(defs.label, node, "label", label, 1);
  531. validate(defs.body, node, "body", body, 1);
  532. return node;
  533. }
  534. function stringLiteral(value) {
  535. const node = {
  536. type: "StringLiteral",
  537. value
  538. };
  539. const defs = NODE_FIELDS.StringLiteral;
  540. validate(defs.value, node, "value", value);
  541. return node;
  542. }
  543. function numericLiteral(value) {
  544. const node = {
  545. type: "NumericLiteral",
  546. value
  547. };
  548. const defs = NODE_FIELDS.NumericLiteral;
  549. validate(defs.value, node, "value", value);
  550. return node;
  551. }
  552. function nullLiteral() {
  553. return {
  554. type: "NullLiteral"
  555. };
  556. }
  557. function booleanLiteral(value) {
  558. const node = {
  559. type: "BooleanLiteral",
  560. value
  561. };
  562. const defs = NODE_FIELDS.BooleanLiteral;
  563. validate(defs.value, node, "value", value);
  564. return node;
  565. }
  566. function regExpLiteral(pattern, flags = "") {
  567. const node = {
  568. type: "RegExpLiteral",
  569. pattern,
  570. flags
  571. };
  572. const defs = NODE_FIELDS.RegExpLiteral;
  573. validate(defs.pattern, node, "pattern", pattern);
  574. validate(defs.flags, node, "flags", flags);
  575. return node;
  576. }
  577. function logicalExpression(operator, left, right) {
  578. const node = {
  579. type: "LogicalExpression",
  580. operator,
  581. left,
  582. right
  583. };
  584. const defs = NODE_FIELDS.LogicalExpression;
  585. validate(defs.operator, node, "operator", operator);
  586. validate(defs.left, node, "left", left, 1);
  587. validate(defs.right, node, "right", right, 1);
  588. return node;
  589. }
  590. function memberExpression(object, property, computed = false, optional = null) {
  591. const node = {
  592. type: "MemberExpression",
  593. object,
  594. property,
  595. computed,
  596. optional
  597. };
  598. const defs = NODE_FIELDS.MemberExpression;
  599. validate(defs.object, node, "object", object, 1);
  600. validate(defs.property, node, "property", property, 1);
  601. validate(defs.computed, node, "computed", computed);
  602. validate(defs.optional, node, "optional", optional);
  603. return node;
  604. }
  605. function newExpression(callee, _arguments) {
  606. const node = {
  607. type: "NewExpression",
  608. callee,
  609. arguments: _arguments
  610. };
  611. const defs = NODE_FIELDS.NewExpression;
  612. validate(defs.callee, node, "callee", callee, 1);
  613. validate(defs.arguments, node, "arguments", _arguments, 1);
  614. return node;
  615. }
  616. function program(body, directives = [], sourceType = "script", interpreter = null) {
  617. const node = {
  618. type: "Program",
  619. body,
  620. directives,
  621. sourceType,
  622. interpreter
  623. };
  624. const defs = NODE_FIELDS.Program;
  625. validate(defs.body, node, "body", body, 1);
  626. validate(defs.directives, node, "directives", directives, 1);
  627. validate(defs.sourceType, node, "sourceType", sourceType);
  628. validate(defs.interpreter, node, "interpreter", interpreter, 1);
  629. return node;
  630. }
  631. function objectExpression(properties) {
  632. const node = {
  633. type: "ObjectExpression",
  634. properties
  635. };
  636. const defs = NODE_FIELDS.ObjectExpression;
  637. validate(defs.properties, node, "properties", properties, 1);
  638. return node;
  639. }
  640. function objectMethod(kind = "method", key, params, body, computed = false, generator = false, async = false) {
  641. const node = {
  642. type: "ObjectMethod",
  643. kind,
  644. key,
  645. params,
  646. body,
  647. computed,
  648. generator,
  649. async
  650. };
  651. const defs = NODE_FIELDS.ObjectMethod;
  652. validate(defs.kind, node, "kind", kind);
  653. validate(defs.key, node, "key", key, 1);
  654. validate(defs.params, node, "params", params, 1);
  655. validate(defs.body, node, "body", body, 1);
  656. validate(defs.computed, node, "computed", computed);
  657. validate(defs.generator, node, "generator", generator);
  658. validate(defs.async, node, "async", async);
  659. return node;
  660. }
  661. function objectProperty(key, value, computed = false, shorthand = false, decorators = null) {
  662. const node = {
  663. type: "ObjectProperty",
  664. key,
  665. value,
  666. computed,
  667. shorthand,
  668. decorators
  669. };
  670. const defs = NODE_FIELDS.ObjectProperty;
  671. validate(defs.key, node, "key", key, 1);
  672. validate(defs.value, node, "value", value, 1);
  673. validate(defs.computed, node, "computed", computed);
  674. validate(defs.shorthand, node, "shorthand", shorthand);
  675. validate(defs.decorators, node, "decorators", decorators, 1);
  676. return node;
  677. }
  678. function restElement(argument) {
  679. const node = {
  680. type: "RestElement",
  681. argument
  682. };
  683. const defs = NODE_FIELDS.RestElement;
  684. validate(defs.argument, node, "argument", argument, 1);
  685. return node;
  686. }
  687. function returnStatement(argument = null) {
  688. const node = {
  689. type: "ReturnStatement",
  690. argument
  691. };
  692. const defs = NODE_FIELDS.ReturnStatement;
  693. validate(defs.argument, node, "argument", argument, 1);
  694. return node;
  695. }
  696. function sequenceExpression(expressions) {
  697. const node = {
  698. type: "SequenceExpression",
  699. expressions
  700. };
  701. const defs = NODE_FIELDS.SequenceExpression;
  702. validate(defs.expressions, node, "expressions", expressions, 1);
  703. return node;
  704. }
  705. function parenthesizedExpression(expression) {
  706. const node = {
  707. type: "ParenthesizedExpression",
  708. expression
  709. };
  710. const defs = NODE_FIELDS.ParenthesizedExpression;
  711. validate(defs.expression, node, "expression", expression, 1);
  712. return node;
  713. }
  714. function switchCase(test = null, consequent) {
  715. const node = {
  716. type: "SwitchCase",
  717. test,
  718. consequent
  719. };
  720. const defs = NODE_FIELDS.SwitchCase;
  721. validate(defs.test, node, "test", test, 1);
  722. validate(defs.consequent, node, "consequent", consequent, 1);
  723. return node;
  724. }
  725. function switchStatement(discriminant, cases) {
  726. const node = {
  727. type: "SwitchStatement",
  728. discriminant,
  729. cases
  730. };
  731. const defs = NODE_FIELDS.SwitchStatement;
  732. validate(defs.discriminant, node, "discriminant", discriminant, 1);
  733. validate(defs.cases, node, "cases", cases, 1);
  734. return node;
  735. }
  736. function thisExpression() {
  737. return {
  738. type: "ThisExpression"
  739. };
  740. }
  741. function throwStatement(argument) {
  742. const node = {
  743. type: "ThrowStatement",
  744. argument
  745. };
  746. const defs = NODE_FIELDS.ThrowStatement;
  747. validate(defs.argument, node, "argument", argument, 1);
  748. return node;
  749. }
  750. function tryStatement(block, handler = null, finalizer = null) {
  751. const node = {
  752. type: "TryStatement",
  753. block,
  754. handler,
  755. finalizer
  756. };
  757. const defs = NODE_FIELDS.TryStatement;
  758. validate(defs.block, node, "block", block, 1);
  759. validate(defs.handler, node, "handler", handler, 1);
  760. validate(defs.finalizer, node, "finalizer", finalizer, 1);
  761. return node;
  762. }
  763. function unaryExpression(operator, argument, prefix = true) {
  764. const node = {
  765. type: "UnaryExpression",
  766. operator,
  767. argument,
  768. prefix
  769. };
  770. const defs = NODE_FIELDS.UnaryExpression;
  771. validate(defs.operator, node, "operator", operator);
  772. validate(defs.argument, node, "argument", argument, 1);
  773. validate(defs.prefix, node, "prefix", prefix);
  774. return node;
  775. }
  776. function updateExpression(operator, argument, prefix = false) {
  777. const node = {
  778. type: "UpdateExpression",
  779. operator,
  780. argument,
  781. prefix
  782. };
  783. const defs = NODE_FIELDS.UpdateExpression;
  784. validate(defs.operator, node, "operator", operator);
  785. validate(defs.argument, node, "argument", argument, 1);
  786. validate(defs.prefix, node, "prefix", prefix);
  787. return node;
  788. }
  789. function variableDeclaration(kind, declarations) {
  790. const node = {
  791. type: "VariableDeclaration",
  792. kind,
  793. declarations
  794. };
  795. const defs = NODE_FIELDS.VariableDeclaration;
  796. validate(defs.kind, node, "kind", kind);
  797. validate(defs.declarations, node, "declarations", declarations, 1);
  798. return node;
  799. }
  800. function variableDeclarator(id, init = null) {
  801. const node = {
  802. type: "VariableDeclarator",
  803. id,
  804. init
  805. };
  806. const defs = NODE_FIELDS.VariableDeclarator;
  807. validate(defs.id, node, "id", id, 1);
  808. validate(defs.init, node, "init", init, 1);
  809. return node;
  810. }
  811. function whileStatement(test, body) {
  812. const node = {
  813. type: "WhileStatement",
  814. test,
  815. body
  816. };
  817. const defs = NODE_FIELDS.WhileStatement;
  818. validate(defs.test, node, "test", test, 1);
  819. validate(defs.body, node, "body", body, 1);
  820. return node;
  821. }
  822. function withStatement(object, body) {
  823. const node = {
  824. type: "WithStatement",
  825. object,
  826. body
  827. };
  828. const defs = NODE_FIELDS.WithStatement;
  829. validate(defs.object, node, "object", object, 1);
  830. validate(defs.body, node, "body", body, 1);
  831. return node;
  832. }
  833. function assignmentPattern(left, right) {
  834. const node = {
  835. type: "AssignmentPattern",
  836. left,
  837. right
  838. };
  839. const defs = NODE_FIELDS.AssignmentPattern;
  840. validate(defs.left, node, "left", left, 1);
  841. validate(defs.right, node, "right", right, 1);
  842. return node;
  843. }
  844. function arrayPattern(elements) {
  845. const node = {
  846. type: "ArrayPattern",
  847. elements
  848. };
  849. const defs = NODE_FIELDS.ArrayPattern;
  850. validate(defs.elements, node, "elements", elements, 1);
  851. return node;
  852. }
  853. function arrowFunctionExpression(params, body, async = false) {
  854. const node = {
  855. type: "ArrowFunctionExpression",
  856. params,
  857. body,
  858. async,
  859. expression: null
  860. };
  861. const defs = NODE_FIELDS.ArrowFunctionExpression;
  862. validate(defs.params, node, "params", params, 1);
  863. validate(defs.body, node, "body", body, 1);
  864. validate(defs.async, node, "async", async);
  865. return node;
  866. }
  867. function classBody(body) {
  868. const node = {
  869. type: "ClassBody",
  870. body
  871. };
  872. const defs = NODE_FIELDS.ClassBody;
  873. validate(defs.body, node, "body", body, 1);
  874. return node;
  875. }
  876. function classExpression(id = null, superClass = null, body, decorators = null) {
  877. const node = {
  878. type: "ClassExpression",
  879. id,
  880. superClass,
  881. body,
  882. decorators
  883. };
  884. const defs = NODE_FIELDS.ClassExpression;
  885. validate(defs.id, node, "id", id, 1);
  886. validate(defs.superClass, node, "superClass", superClass, 1);
  887. validate(defs.body, node, "body", body, 1);
  888. validate(defs.decorators, node, "decorators", decorators, 1);
  889. return node;
  890. }
  891. function classDeclaration(id = null, superClass = null, body, decorators = null) {
  892. const node = {
  893. type: "ClassDeclaration",
  894. id,
  895. superClass,
  896. body,
  897. decorators
  898. };
  899. const defs = NODE_FIELDS.ClassDeclaration;
  900. validate(defs.id, node, "id", id, 1);
  901. validate(defs.superClass, node, "superClass", superClass, 1);
  902. validate(defs.body, node, "body", body, 1);
  903. validate(defs.decorators, node, "decorators", decorators, 1);
  904. return node;
  905. }
  906. function exportAllDeclaration(source) {
  907. const node = {
  908. type: "ExportAllDeclaration",
  909. source
  910. };
  911. const defs = NODE_FIELDS.ExportAllDeclaration;
  912. validate(defs.source, node, "source", source, 1);
  913. return node;
  914. }
  915. function exportDefaultDeclaration(declaration) {
  916. const node = {
  917. type: "ExportDefaultDeclaration",
  918. declaration
  919. };
  920. const defs = NODE_FIELDS.ExportDefaultDeclaration;
  921. validate(defs.declaration, node, "declaration", declaration, 1);
  922. return node;
  923. }
  924. function exportNamedDeclaration(declaration = null, specifiers = [], source = null) {
  925. const node = {
  926. type: "ExportNamedDeclaration",
  927. declaration,
  928. specifiers,
  929. source
  930. };
  931. const defs = NODE_FIELDS.ExportNamedDeclaration;
  932. validate(defs.declaration, node, "declaration", declaration, 1);
  933. validate(defs.specifiers, node, "specifiers", specifiers, 1);
  934. validate(defs.source, node, "source", source, 1);
  935. return node;
  936. }
  937. function exportSpecifier(local, exported) {
  938. const node = {
  939. type: "ExportSpecifier",
  940. local,
  941. exported
  942. };
  943. const defs = NODE_FIELDS.ExportSpecifier;
  944. validate(defs.local, node, "local", local, 1);
  945. validate(defs.exported, node, "exported", exported, 1);
  946. return node;
  947. }
  948. function forOfStatement(left, right, body, _await = false) {
  949. const node = {
  950. type: "ForOfStatement",
  951. left,
  952. right,
  953. body,
  954. await: _await
  955. };
  956. const defs = NODE_FIELDS.ForOfStatement;
  957. validate(defs.left, node, "left", left, 1);
  958. validate(defs.right, node, "right", right, 1);
  959. validate(defs.body, node, "body", body, 1);
  960. validate(defs.await, node, "await", _await);
  961. return node;
  962. }
  963. function importDeclaration(specifiers, source) {
  964. const node = {
  965. type: "ImportDeclaration",
  966. specifiers,
  967. source
  968. };
  969. const defs = NODE_FIELDS.ImportDeclaration;
  970. validate(defs.specifiers, node, "specifiers", specifiers, 1);
  971. validate(defs.source, node, "source", source, 1);
  972. return node;
  973. }
  974. function importDefaultSpecifier(local) {
  975. const node = {
  976. type: "ImportDefaultSpecifier",
  977. local
  978. };
  979. const defs = NODE_FIELDS.ImportDefaultSpecifier;
  980. validate(defs.local, node, "local", local, 1);
  981. return node;
  982. }
  983. function importNamespaceSpecifier(local) {
  984. const node = {
  985. type: "ImportNamespaceSpecifier",
  986. local
  987. };
  988. const defs = NODE_FIELDS.ImportNamespaceSpecifier;
  989. validate(defs.local, node, "local", local, 1);
  990. return node;
  991. }
  992. function importSpecifier(local, imported) {
  993. const node = {
  994. type: "ImportSpecifier",
  995. local,
  996. imported
  997. };
  998. const defs = NODE_FIELDS.ImportSpecifier;
  999. validate(defs.local, node, "local", local, 1);
  1000. validate(defs.imported, node, "imported", imported, 1);
  1001. return node;
  1002. }
  1003. function importExpression(source, options = null) {
  1004. const node = {
  1005. type: "ImportExpression",
  1006. source,
  1007. options
  1008. };
  1009. const defs = NODE_FIELDS.ImportExpression;
  1010. validate(defs.source, node, "source", source, 1);
  1011. validate(defs.options, node, "options", options, 1);
  1012. return node;
  1013. }
  1014. function metaProperty(meta, property) {
  1015. const node = {
  1016. type: "MetaProperty",
  1017. meta,
  1018. property
  1019. };
  1020. const defs = NODE_FIELDS.MetaProperty;
  1021. validate(defs.meta, node, "meta", meta, 1);
  1022. validate(defs.property, node, "property", property, 1);
  1023. return node;
  1024. }
  1025. function classMethod(kind = "method", key, params, body, computed = false, _static = false, generator = false, async = false) {
  1026. const node = {
  1027. type: "ClassMethod",
  1028. kind,
  1029. key,
  1030. params,
  1031. body,
  1032. computed,
  1033. static: _static,
  1034. generator,
  1035. async
  1036. };
  1037. const defs = NODE_FIELDS.ClassMethod;
  1038. validate(defs.kind, node, "kind", kind);
  1039. validate(defs.key, node, "key", key, 1);
  1040. validate(defs.params, node, "params", params, 1);
  1041. validate(defs.body, node, "body", body, 1);
  1042. validate(defs.computed, node, "computed", computed);
  1043. validate(defs.static, node, "static", _static);
  1044. validate(defs.generator, node, "generator", generator);
  1045. validate(defs.async, node, "async", async);
  1046. return node;
  1047. }
  1048. function objectPattern(properties) {
  1049. const node = {
  1050. type: "ObjectPattern",
  1051. properties
  1052. };
  1053. const defs = NODE_FIELDS.ObjectPattern;
  1054. validate(defs.properties, node, "properties", properties, 1);
  1055. return node;
  1056. }
  1057. function spreadElement(argument) {
  1058. const node = {
  1059. type: "SpreadElement",
  1060. argument
  1061. };
  1062. const defs = NODE_FIELDS.SpreadElement;
  1063. validate(defs.argument, node, "argument", argument, 1);
  1064. return node;
  1065. }
  1066. function _super() {
  1067. return {
  1068. type: "Super"
  1069. };
  1070. }
  1071. function taggedTemplateExpression(tag, quasi) {
  1072. const node = {
  1073. type: "TaggedTemplateExpression",
  1074. tag,
  1075. quasi
  1076. };
  1077. const defs = NODE_FIELDS.TaggedTemplateExpression;
  1078. validate(defs.tag, node, "tag", tag, 1);
  1079. validate(defs.quasi, node, "quasi", quasi, 1);
  1080. return node;
  1081. }
  1082. function templateElement(value, tail = false) {
  1083. const node = {
  1084. type: "TemplateElement",
  1085. value,
  1086. tail
  1087. };
  1088. const defs = NODE_FIELDS.TemplateElement;
  1089. validate(defs.value, node, "value", value);
  1090. validate(defs.tail, node, "tail", tail);
  1091. return node;
  1092. }
  1093. function templateLiteral(quasis, expressions) {
  1094. const node = {
  1095. type: "TemplateLiteral",
  1096. quasis,
  1097. expressions
  1098. };
  1099. const defs = NODE_FIELDS.TemplateLiteral;
  1100. validate(defs.quasis, node, "quasis", quasis, 1);
  1101. validate(defs.expressions, node, "expressions", expressions, 1);
  1102. return node;
  1103. }
  1104. function yieldExpression(argument = null, delegate = false) {
  1105. const node = {
  1106. type: "YieldExpression",
  1107. argument,
  1108. delegate
  1109. };
  1110. const defs = NODE_FIELDS.YieldExpression;
  1111. validate(defs.argument, node, "argument", argument, 1);
  1112. validate(defs.delegate, node, "delegate", delegate);
  1113. return node;
  1114. }
  1115. function awaitExpression(argument) {
  1116. const node = {
  1117. type: "AwaitExpression",
  1118. argument
  1119. };
  1120. const defs = NODE_FIELDS.AwaitExpression;
  1121. validate(defs.argument, node, "argument", argument, 1);
  1122. return node;
  1123. }
  1124. function _import() {
  1125. return {
  1126. type: "Import"
  1127. };
  1128. }
  1129. function bigIntLiteral(value) {
  1130. const node = {
  1131. type: "BigIntLiteral",
  1132. value
  1133. };
  1134. const defs = NODE_FIELDS.BigIntLiteral;
  1135. validate(defs.value, node, "value", value);
  1136. return node;
  1137. }
  1138. function exportNamespaceSpecifier(exported) {
  1139. const node = {
  1140. type: "ExportNamespaceSpecifier",
  1141. exported
  1142. };
  1143. const defs = NODE_FIELDS.ExportNamespaceSpecifier;
  1144. validate(defs.exported, node, "exported", exported, 1);
  1145. return node;
  1146. }
  1147. function optionalMemberExpression(object, property, computed = false, optional) {
  1148. const node = {
  1149. type: "OptionalMemberExpression",
  1150. object,
  1151. property,
  1152. computed,
  1153. optional
  1154. };
  1155. const defs = NODE_FIELDS.OptionalMemberExpression;
  1156. validate(defs.object, node, "object", object, 1);
  1157. validate(defs.property, node, "property", property, 1);
  1158. validate(defs.computed, node, "computed", computed);
  1159. validate(defs.optional, node, "optional", optional);
  1160. return node;
  1161. }
  1162. function optionalCallExpression(callee, _arguments, optional) {
  1163. const node = {
  1164. type: "OptionalCallExpression",
  1165. callee,
  1166. arguments: _arguments,
  1167. optional
  1168. };
  1169. const defs = NODE_FIELDS.OptionalCallExpression;
  1170. validate(defs.callee, node, "callee", callee, 1);
  1171. validate(defs.arguments, node, "arguments", _arguments, 1);
  1172. validate(defs.optional, node, "optional", optional);
  1173. return node;
  1174. }
  1175. function classProperty(key, value = null, typeAnnotation = null, decorators = null, computed = false, _static = false) {
  1176. const node = {
  1177. type: "ClassProperty",
  1178. key,
  1179. value,
  1180. typeAnnotation,
  1181. decorators,
  1182. computed,
  1183. static: _static
  1184. };
  1185. const defs = NODE_FIELDS.ClassProperty;
  1186. validate(defs.key, node, "key", key, 1);
  1187. validate(defs.value, node, "value", value, 1);
  1188. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  1189. validate(defs.decorators, node, "decorators", decorators, 1);
  1190. validate(defs.computed, node, "computed", computed);
  1191. validate(defs.static, node, "static", _static);
  1192. return node;
  1193. }
  1194. function classAccessorProperty(key, value = null, typeAnnotation = null, decorators = null, computed = false, _static = false) {
  1195. const node = {
  1196. type: "ClassAccessorProperty",
  1197. key,
  1198. value,
  1199. typeAnnotation,
  1200. decorators,
  1201. computed,
  1202. static: _static
  1203. };
  1204. const defs = NODE_FIELDS.ClassAccessorProperty;
  1205. validate(defs.key, node, "key", key, 1);
  1206. validate(defs.value, node, "value", value, 1);
  1207. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  1208. validate(defs.decorators, node, "decorators", decorators, 1);
  1209. validate(defs.computed, node, "computed", computed);
  1210. validate(defs.static, node, "static", _static);
  1211. return node;
  1212. }
  1213. function classPrivateProperty(key, value = null, decorators = null, _static = false) {
  1214. const node = {
  1215. type: "ClassPrivateProperty",
  1216. key,
  1217. value,
  1218. decorators,
  1219. static: _static
  1220. };
  1221. const defs = NODE_FIELDS.ClassPrivateProperty;
  1222. validate(defs.key, node, "key", key, 1);
  1223. validate(defs.value, node, "value", value, 1);
  1224. validate(defs.decorators, node, "decorators", decorators, 1);
  1225. validate(defs.static, node, "static", _static);
  1226. return node;
  1227. }
  1228. function classPrivateMethod(kind = "method", key, params, body, _static = false) {
  1229. const node = {
  1230. type: "ClassPrivateMethod",
  1231. kind,
  1232. key,
  1233. params,
  1234. body,
  1235. static: _static
  1236. };
  1237. const defs = NODE_FIELDS.ClassPrivateMethod;
  1238. validate(defs.kind, node, "kind", kind);
  1239. validate(defs.key, node, "key", key, 1);
  1240. validate(defs.params, node, "params", params, 1);
  1241. validate(defs.body, node, "body", body, 1);
  1242. validate(defs.static, node, "static", _static);
  1243. return node;
  1244. }
  1245. function privateName(id) {
  1246. const node = {
  1247. type: "PrivateName",
  1248. id
  1249. };
  1250. const defs = NODE_FIELDS.PrivateName;
  1251. validate(defs.id, node, "id", id, 1);
  1252. return node;
  1253. }
  1254. function staticBlock(body) {
  1255. const node = {
  1256. type: "StaticBlock",
  1257. body
  1258. };
  1259. const defs = NODE_FIELDS.StaticBlock;
  1260. validate(defs.body, node, "body", body, 1);
  1261. return node;
  1262. }
  1263. function importAttribute(key, value) {
  1264. const node = {
  1265. type: "ImportAttribute",
  1266. key,
  1267. value
  1268. };
  1269. const defs = NODE_FIELDS.ImportAttribute;
  1270. validate(defs.key, node, "key", key, 1);
  1271. validate(defs.value, node, "value", value, 1);
  1272. return node;
  1273. }
  1274. function anyTypeAnnotation() {
  1275. return {
  1276. type: "AnyTypeAnnotation"
  1277. };
  1278. }
  1279. function arrayTypeAnnotation(elementType) {
  1280. const node = {
  1281. type: "ArrayTypeAnnotation",
  1282. elementType
  1283. };
  1284. const defs = NODE_FIELDS.ArrayTypeAnnotation;
  1285. validate(defs.elementType, node, "elementType", elementType, 1);
  1286. return node;
  1287. }
  1288. function booleanTypeAnnotation() {
  1289. return {
  1290. type: "BooleanTypeAnnotation"
  1291. };
  1292. }
  1293. function booleanLiteralTypeAnnotation(value) {
  1294. const node = {
  1295. type: "BooleanLiteralTypeAnnotation",
  1296. value
  1297. };
  1298. const defs = NODE_FIELDS.BooleanLiteralTypeAnnotation;
  1299. validate(defs.value, node, "value", value);
  1300. return node;
  1301. }
  1302. function nullLiteralTypeAnnotation() {
  1303. return {
  1304. type: "NullLiteralTypeAnnotation"
  1305. };
  1306. }
  1307. function classImplements(id, typeParameters = null) {
  1308. const node = {
  1309. type: "ClassImplements",
  1310. id,
  1311. typeParameters
  1312. };
  1313. const defs = NODE_FIELDS.ClassImplements;
  1314. validate(defs.id, node, "id", id, 1);
  1315. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  1316. return node;
  1317. }
  1318. function declareClass(id, typeParameters = null, _extends = null, body) {
  1319. const node = {
  1320. type: "DeclareClass",
  1321. id,
  1322. typeParameters,
  1323. extends: _extends,
  1324. body
  1325. };
  1326. const defs = NODE_FIELDS.DeclareClass;
  1327. validate(defs.id, node, "id", id, 1);
  1328. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  1329. validate(defs.extends, node, "extends", _extends, 1);
  1330. validate(defs.body, node, "body", body, 1);
  1331. return node;
  1332. }
  1333. function declareFunction(id) {
  1334. const node = {
  1335. type: "DeclareFunction",
  1336. id
  1337. };
  1338. const defs = NODE_FIELDS.DeclareFunction;
  1339. validate(defs.id, node, "id", id, 1);
  1340. return node;
  1341. }
  1342. function declareInterface(id, typeParameters = null, _extends = null, body) {
  1343. const node = {
  1344. type: "DeclareInterface",
  1345. id,
  1346. typeParameters,
  1347. extends: _extends,
  1348. body
  1349. };
  1350. const defs = NODE_FIELDS.DeclareInterface;
  1351. validate(defs.id, node, "id", id, 1);
  1352. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  1353. validate(defs.extends, node, "extends", _extends, 1);
  1354. validate(defs.body, node, "body", body, 1);
  1355. return node;
  1356. }
  1357. function declareModule(id, body, kind = null) {
  1358. const node = {
  1359. type: "DeclareModule",
  1360. id,
  1361. body,
  1362. kind
  1363. };
  1364. const defs = NODE_FIELDS.DeclareModule;
  1365. validate(defs.id, node, "id", id, 1);
  1366. validate(defs.body, node, "body", body, 1);
  1367. validate(defs.kind, node, "kind", kind);
  1368. return node;
  1369. }
  1370. function declareModuleExports(typeAnnotation) {
  1371. const node = {
  1372. type: "DeclareModuleExports",
  1373. typeAnnotation
  1374. };
  1375. const defs = NODE_FIELDS.DeclareModuleExports;
  1376. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  1377. return node;
  1378. }
  1379. function declareTypeAlias(id, typeParameters = null, right) {
  1380. const node = {
  1381. type: "DeclareTypeAlias",
  1382. id,
  1383. typeParameters,
  1384. right
  1385. };
  1386. const defs = NODE_FIELDS.DeclareTypeAlias;
  1387. validate(defs.id, node, "id", id, 1);
  1388. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  1389. validate(defs.right, node, "right", right, 1);
  1390. return node;
  1391. }
  1392. function declareOpaqueType(id, typeParameters = null, supertype = null) {
  1393. const node = {
  1394. type: "DeclareOpaqueType",
  1395. id,
  1396. typeParameters,
  1397. supertype
  1398. };
  1399. const defs = NODE_FIELDS.DeclareOpaqueType;
  1400. validate(defs.id, node, "id", id, 1);
  1401. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  1402. validate(defs.supertype, node, "supertype", supertype, 1);
  1403. return node;
  1404. }
  1405. function declareVariable(id) {
  1406. const node = {
  1407. type: "DeclareVariable",
  1408. id
  1409. };
  1410. const defs = NODE_FIELDS.DeclareVariable;
  1411. validate(defs.id, node, "id", id, 1);
  1412. return node;
  1413. }
  1414. function declareExportDeclaration(declaration = null, specifiers = null, source = null, attributes = null) {
  1415. const node = {
  1416. type: "DeclareExportDeclaration",
  1417. declaration,
  1418. specifiers,
  1419. source,
  1420. attributes
  1421. };
  1422. const defs = NODE_FIELDS.DeclareExportDeclaration;
  1423. validate(defs.declaration, node, "declaration", declaration, 1);
  1424. validate(defs.specifiers, node, "specifiers", specifiers, 1);
  1425. validate(defs.source, node, "source", source, 1);
  1426. validate(defs.attributes, node, "attributes", attributes, 1);
  1427. return node;
  1428. }
  1429. function declareExportAllDeclaration(source, attributes = null) {
  1430. const node = {
  1431. type: "DeclareExportAllDeclaration",
  1432. source,
  1433. attributes
  1434. };
  1435. const defs = NODE_FIELDS.DeclareExportAllDeclaration;
  1436. validate(defs.source, node, "source", source, 1);
  1437. validate(defs.attributes, node, "attributes", attributes, 1);
  1438. return node;
  1439. }
  1440. function declaredPredicate(value) {
  1441. const node = {
  1442. type: "DeclaredPredicate",
  1443. value
  1444. };
  1445. const defs = NODE_FIELDS.DeclaredPredicate;
  1446. validate(defs.value, node, "value", value, 1);
  1447. return node;
  1448. }
  1449. function existsTypeAnnotation() {
  1450. return {
  1451. type: "ExistsTypeAnnotation"
  1452. };
  1453. }
  1454. function functionTypeAnnotation(typeParameters = null, params, rest = null, returnType) {
  1455. const node = {
  1456. type: "FunctionTypeAnnotation",
  1457. typeParameters,
  1458. params,
  1459. rest,
  1460. returnType
  1461. };
  1462. const defs = NODE_FIELDS.FunctionTypeAnnotation;
  1463. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  1464. validate(defs.params, node, "params", params, 1);
  1465. validate(defs.rest, node, "rest", rest, 1);
  1466. validate(defs.returnType, node, "returnType", returnType, 1);
  1467. return node;
  1468. }
  1469. function functionTypeParam(name = null, typeAnnotation) {
  1470. const node = {
  1471. type: "FunctionTypeParam",
  1472. name,
  1473. typeAnnotation
  1474. };
  1475. const defs = NODE_FIELDS.FunctionTypeParam;
  1476. validate(defs.name, node, "name", name, 1);
  1477. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  1478. return node;
  1479. }
  1480. function genericTypeAnnotation(id, typeParameters = null) {
  1481. const node = {
  1482. type: "GenericTypeAnnotation",
  1483. id,
  1484. typeParameters
  1485. };
  1486. const defs = NODE_FIELDS.GenericTypeAnnotation;
  1487. validate(defs.id, node, "id", id, 1);
  1488. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  1489. return node;
  1490. }
  1491. function inferredPredicate() {
  1492. return {
  1493. type: "InferredPredicate"
  1494. };
  1495. }
  1496. function interfaceExtends(id, typeParameters = null) {
  1497. const node = {
  1498. type: "InterfaceExtends",
  1499. id,
  1500. typeParameters
  1501. };
  1502. const defs = NODE_FIELDS.InterfaceExtends;
  1503. validate(defs.id, node, "id", id, 1);
  1504. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  1505. return node;
  1506. }
  1507. function interfaceDeclaration(id, typeParameters = null, _extends = null, body) {
  1508. const node = {
  1509. type: "InterfaceDeclaration",
  1510. id,
  1511. typeParameters,
  1512. extends: _extends,
  1513. body
  1514. };
  1515. const defs = NODE_FIELDS.InterfaceDeclaration;
  1516. validate(defs.id, node, "id", id, 1);
  1517. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  1518. validate(defs.extends, node, "extends", _extends, 1);
  1519. validate(defs.body, node, "body", body, 1);
  1520. return node;
  1521. }
  1522. function interfaceTypeAnnotation(_extends = null, body) {
  1523. const node = {
  1524. type: "InterfaceTypeAnnotation",
  1525. extends: _extends,
  1526. body
  1527. };
  1528. const defs = NODE_FIELDS.InterfaceTypeAnnotation;
  1529. validate(defs.extends, node, "extends", _extends, 1);
  1530. validate(defs.body, node, "body", body, 1);
  1531. return node;
  1532. }
  1533. function intersectionTypeAnnotation(types) {
  1534. const node = {
  1535. type: "IntersectionTypeAnnotation",
  1536. types
  1537. };
  1538. const defs = NODE_FIELDS.IntersectionTypeAnnotation;
  1539. validate(defs.types, node, "types", types, 1);
  1540. return node;
  1541. }
  1542. function mixedTypeAnnotation() {
  1543. return {
  1544. type: "MixedTypeAnnotation"
  1545. };
  1546. }
  1547. function emptyTypeAnnotation() {
  1548. return {
  1549. type: "EmptyTypeAnnotation"
  1550. };
  1551. }
  1552. function nullableTypeAnnotation(typeAnnotation) {
  1553. const node = {
  1554. type: "NullableTypeAnnotation",
  1555. typeAnnotation
  1556. };
  1557. const defs = NODE_FIELDS.NullableTypeAnnotation;
  1558. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  1559. return node;
  1560. }
  1561. function numberLiteralTypeAnnotation(value) {
  1562. const node = {
  1563. type: "NumberLiteralTypeAnnotation",
  1564. value
  1565. };
  1566. const defs = NODE_FIELDS.NumberLiteralTypeAnnotation;
  1567. validate(defs.value, node, "value", value);
  1568. return node;
  1569. }
  1570. function numberTypeAnnotation() {
  1571. return {
  1572. type: "NumberTypeAnnotation"
  1573. };
  1574. }
  1575. function objectTypeAnnotation(properties, indexers = [], callProperties = [], internalSlots = [], exact = false) {
  1576. const node = {
  1577. type: "ObjectTypeAnnotation",
  1578. properties,
  1579. indexers,
  1580. callProperties,
  1581. internalSlots,
  1582. exact
  1583. };
  1584. const defs = NODE_FIELDS.ObjectTypeAnnotation;
  1585. validate(defs.properties, node, "properties", properties, 1);
  1586. validate(defs.indexers, node, "indexers", indexers, 1);
  1587. validate(defs.callProperties, node, "callProperties", callProperties, 1);
  1588. validate(defs.internalSlots, node, "internalSlots", internalSlots, 1);
  1589. validate(defs.exact, node, "exact", exact);
  1590. return node;
  1591. }
  1592. function objectTypeInternalSlot(id, value, optional, _static, method) {
  1593. const node = {
  1594. type: "ObjectTypeInternalSlot",
  1595. id,
  1596. value,
  1597. optional,
  1598. static: _static,
  1599. method
  1600. };
  1601. const defs = NODE_FIELDS.ObjectTypeInternalSlot;
  1602. validate(defs.id, node, "id", id, 1);
  1603. validate(defs.value, node, "value", value, 1);
  1604. validate(defs.optional, node, "optional", optional);
  1605. validate(defs.static, node, "static", _static);
  1606. validate(defs.method, node, "method", method);
  1607. return node;
  1608. }
  1609. function objectTypeCallProperty(value) {
  1610. const node = {
  1611. type: "ObjectTypeCallProperty",
  1612. value,
  1613. static: null
  1614. };
  1615. const defs = NODE_FIELDS.ObjectTypeCallProperty;
  1616. validate(defs.value, node, "value", value, 1);
  1617. return node;
  1618. }
  1619. function objectTypeIndexer(id = null, key, value, variance = null) {
  1620. const node = {
  1621. type: "ObjectTypeIndexer",
  1622. id,
  1623. key,
  1624. value,
  1625. variance,
  1626. static: null
  1627. };
  1628. const defs = NODE_FIELDS.ObjectTypeIndexer;
  1629. validate(defs.id, node, "id", id, 1);
  1630. validate(defs.key, node, "key", key, 1);
  1631. validate(defs.value, node, "value", value, 1);
  1632. validate(defs.variance, node, "variance", variance, 1);
  1633. return node;
  1634. }
  1635. function objectTypeProperty(key, value, variance = null) {
  1636. const node = {
  1637. type: "ObjectTypeProperty",
  1638. key,
  1639. value,
  1640. variance,
  1641. kind: null,
  1642. method: null,
  1643. optional: null,
  1644. proto: null,
  1645. static: null
  1646. };
  1647. const defs = NODE_FIELDS.ObjectTypeProperty;
  1648. validate(defs.key, node, "key", key, 1);
  1649. validate(defs.value, node, "value", value, 1);
  1650. validate(defs.variance, node, "variance", variance, 1);
  1651. return node;
  1652. }
  1653. function objectTypeSpreadProperty(argument) {
  1654. const node = {
  1655. type: "ObjectTypeSpreadProperty",
  1656. argument
  1657. };
  1658. const defs = NODE_FIELDS.ObjectTypeSpreadProperty;
  1659. validate(defs.argument, node, "argument", argument, 1);
  1660. return node;
  1661. }
  1662. function opaqueType(id, typeParameters = null, supertype = null, impltype) {
  1663. const node = {
  1664. type: "OpaqueType",
  1665. id,
  1666. typeParameters,
  1667. supertype,
  1668. impltype
  1669. };
  1670. const defs = NODE_FIELDS.OpaqueType;
  1671. validate(defs.id, node, "id", id, 1);
  1672. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  1673. validate(defs.supertype, node, "supertype", supertype, 1);
  1674. validate(defs.impltype, node, "impltype", impltype, 1);
  1675. return node;
  1676. }
  1677. function qualifiedTypeIdentifier(id, qualification) {
  1678. const node = {
  1679. type: "QualifiedTypeIdentifier",
  1680. id,
  1681. qualification
  1682. };
  1683. const defs = NODE_FIELDS.QualifiedTypeIdentifier;
  1684. validate(defs.id, node, "id", id, 1);
  1685. validate(defs.qualification, node, "qualification", qualification, 1);
  1686. return node;
  1687. }
  1688. function stringLiteralTypeAnnotation(value) {
  1689. const node = {
  1690. type: "StringLiteralTypeAnnotation",
  1691. value
  1692. };
  1693. const defs = NODE_FIELDS.StringLiteralTypeAnnotation;
  1694. validate(defs.value, node, "value", value);
  1695. return node;
  1696. }
  1697. function stringTypeAnnotation() {
  1698. return {
  1699. type: "StringTypeAnnotation"
  1700. };
  1701. }
  1702. function symbolTypeAnnotation() {
  1703. return {
  1704. type: "SymbolTypeAnnotation"
  1705. };
  1706. }
  1707. function thisTypeAnnotation() {
  1708. return {
  1709. type: "ThisTypeAnnotation"
  1710. };
  1711. }
  1712. function tupleTypeAnnotation(types) {
  1713. const node = {
  1714. type: "TupleTypeAnnotation",
  1715. types
  1716. };
  1717. const defs = NODE_FIELDS.TupleTypeAnnotation;
  1718. validate(defs.types, node, "types", types, 1);
  1719. return node;
  1720. }
  1721. function typeofTypeAnnotation(argument) {
  1722. const node = {
  1723. type: "TypeofTypeAnnotation",
  1724. argument
  1725. };
  1726. const defs = NODE_FIELDS.TypeofTypeAnnotation;
  1727. validate(defs.argument, node, "argument", argument, 1);
  1728. return node;
  1729. }
  1730. function typeAlias(id, typeParameters = null, right) {
  1731. const node = {
  1732. type: "TypeAlias",
  1733. id,
  1734. typeParameters,
  1735. right
  1736. };
  1737. const defs = NODE_FIELDS.TypeAlias;
  1738. validate(defs.id, node, "id", id, 1);
  1739. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  1740. validate(defs.right, node, "right", right, 1);
  1741. return node;
  1742. }
  1743. function typeAnnotation(typeAnnotation) {
  1744. const node = {
  1745. type: "TypeAnnotation",
  1746. typeAnnotation
  1747. };
  1748. const defs = NODE_FIELDS.TypeAnnotation;
  1749. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  1750. return node;
  1751. }
  1752. function typeCastExpression(expression, typeAnnotation) {
  1753. const node = {
  1754. type: "TypeCastExpression",
  1755. expression,
  1756. typeAnnotation
  1757. };
  1758. const defs = NODE_FIELDS.TypeCastExpression;
  1759. validate(defs.expression, node, "expression", expression, 1);
  1760. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  1761. return node;
  1762. }
  1763. function typeParameter(bound = null, _default = null, variance = null) {
  1764. const node = {
  1765. type: "TypeParameter",
  1766. bound,
  1767. default: _default,
  1768. variance,
  1769. name: null
  1770. };
  1771. const defs = NODE_FIELDS.TypeParameter;
  1772. validate(defs.bound, node, "bound", bound, 1);
  1773. validate(defs.default, node, "default", _default, 1);
  1774. validate(defs.variance, node, "variance", variance, 1);
  1775. return node;
  1776. }
  1777. function typeParameterDeclaration(params) {
  1778. const node = {
  1779. type: "TypeParameterDeclaration",
  1780. params
  1781. };
  1782. const defs = NODE_FIELDS.TypeParameterDeclaration;
  1783. validate(defs.params, node, "params", params, 1);
  1784. return node;
  1785. }
  1786. function typeParameterInstantiation(params) {
  1787. const node = {
  1788. type: "TypeParameterInstantiation",
  1789. params
  1790. };
  1791. const defs = NODE_FIELDS.TypeParameterInstantiation;
  1792. validate(defs.params, node, "params", params, 1);
  1793. return node;
  1794. }
  1795. function unionTypeAnnotation(types) {
  1796. const node = {
  1797. type: "UnionTypeAnnotation",
  1798. types
  1799. };
  1800. const defs = NODE_FIELDS.UnionTypeAnnotation;
  1801. validate(defs.types, node, "types", types, 1);
  1802. return node;
  1803. }
  1804. function variance(kind) {
  1805. const node = {
  1806. type: "Variance",
  1807. kind
  1808. };
  1809. const defs = NODE_FIELDS.Variance;
  1810. validate(defs.kind, node, "kind", kind);
  1811. return node;
  1812. }
  1813. function voidTypeAnnotation() {
  1814. return {
  1815. type: "VoidTypeAnnotation"
  1816. };
  1817. }
  1818. function enumDeclaration(id, body) {
  1819. const node = {
  1820. type: "EnumDeclaration",
  1821. id,
  1822. body
  1823. };
  1824. const defs = NODE_FIELDS.EnumDeclaration;
  1825. validate(defs.id, node, "id", id, 1);
  1826. validate(defs.body, node, "body", body, 1);
  1827. return node;
  1828. }
  1829. function enumBooleanBody(members) {
  1830. const node = {
  1831. type: "EnumBooleanBody",
  1832. members,
  1833. explicitType: null,
  1834. hasUnknownMembers: null
  1835. };
  1836. const defs = NODE_FIELDS.EnumBooleanBody;
  1837. validate(defs.members, node, "members", members, 1);
  1838. return node;
  1839. }
  1840. function enumNumberBody(members) {
  1841. const node = {
  1842. type: "EnumNumberBody",
  1843. members,
  1844. explicitType: null,
  1845. hasUnknownMembers: null
  1846. };
  1847. const defs = NODE_FIELDS.EnumNumberBody;
  1848. validate(defs.members, node, "members", members, 1);
  1849. return node;
  1850. }
  1851. function enumStringBody(members) {
  1852. const node = {
  1853. type: "EnumStringBody",
  1854. members,
  1855. explicitType: null,
  1856. hasUnknownMembers: null
  1857. };
  1858. const defs = NODE_FIELDS.EnumStringBody;
  1859. validate(defs.members, node, "members", members, 1);
  1860. return node;
  1861. }
  1862. function enumSymbolBody(members) {
  1863. const node = {
  1864. type: "EnumSymbolBody",
  1865. members,
  1866. hasUnknownMembers: null
  1867. };
  1868. const defs = NODE_FIELDS.EnumSymbolBody;
  1869. validate(defs.members, node, "members", members, 1);
  1870. return node;
  1871. }
  1872. function enumBooleanMember(id) {
  1873. const node = {
  1874. type: "EnumBooleanMember",
  1875. id,
  1876. init: null
  1877. };
  1878. const defs = NODE_FIELDS.EnumBooleanMember;
  1879. validate(defs.id, node, "id", id, 1);
  1880. return node;
  1881. }
  1882. function enumNumberMember(id, init) {
  1883. const node = {
  1884. type: "EnumNumberMember",
  1885. id,
  1886. init
  1887. };
  1888. const defs = NODE_FIELDS.EnumNumberMember;
  1889. validate(defs.id, node, "id", id, 1);
  1890. validate(defs.init, node, "init", init, 1);
  1891. return node;
  1892. }
  1893. function enumStringMember(id, init) {
  1894. const node = {
  1895. type: "EnumStringMember",
  1896. id,
  1897. init
  1898. };
  1899. const defs = NODE_FIELDS.EnumStringMember;
  1900. validate(defs.id, node, "id", id, 1);
  1901. validate(defs.init, node, "init", init, 1);
  1902. return node;
  1903. }
  1904. function enumDefaultedMember(id) {
  1905. const node = {
  1906. type: "EnumDefaultedMember",
  1907. id
  1908. };
  1909. const defs = NODE_FIELDS.EnumDefaultedMember;
  1910. validate(defs.id, node, "id", id, 1);
  1911. return node;
  1912. }
  1913. function indexedAccessType(objectType, indexType) {
  1914. const node = {
  1915. type: "IndexedAccessType",
  1916. objectType,
  1917. indexType
  1918. };
  1919. const defs = NODE_FIELDS.IndexedAccessType;
  1920. validate(defs.objectType, node, "objectType", objectType, 1);
  1921. validate(defs.indexType, node, "indexType", indexType, 1);
  1922. return node;
  1923. }
  1924. function optionalIndexedAccessType(objectType, indexType) {
  1925. const node = {
  1926. type: "OptionalIndexedAccessType",
  1927. objectType,
  1928. indexType,
  1929. optional: null
  1930. };
  1931. const defs = NODE_FIELDS.OptionalIndexedAccessType;
  1932. validate(defs.objectType, node, "objectType", objectType, 1);
  1933. validate(defs.indexType, node, "indexType", indexType, 1);
  1934. return node;
  1935. }
  1936. function jsxAttribute(name, value = null) {
  1937. const node = {
  1938. type: "JSXAttribute",
  1939. name,
  1940. value
  1941. };
  1942. const defs = NODE_FIELDS.JSXAttribute;
  1943. validate(defs.name, node, "name", name, 1);
  1944. validate(defs.value, node, "value", value, 1);
  1945. return node;
  1946. }
  1947. function jsxClosingElement(name) {
  1948. const node = {
  1949. type: "JSXClosingElement",
  1950. name
  1951. };
  1952. const defs = NODE_FIELDS.JSXClosingElement;
  1953. validate(defs.name, node, "name", name, 1);
  1954. return node;
  1955. }
  1956. function jsxElement(openingElement, closingElement = null, children, selfClosing = null) {
  1957. const node = {
  1958. type: "JSXElement",
  1959. openingElement,
  1960. closingElement,
  1961. children,
  1962. selfClosing
  1963. };
  1964. const defs = NODE_FIELDS.JSXElement;
  1965. validate(defs.openingElement, node, "openingElement", openingElement, 1);
  1966. validate(defs.closingElement, node, "closingElement", closingElement, 1);
  1967. validate(defs.children, node, "children", children, 1);
  1968. validate(defs.selfClosing, node, "selfClosing", selfClosing);
  1969. return node;
  1970. }
  1971. function jsxEmptyExpression() {
  1972. return {
  1973. type: "JSXEmptyExpression"
  1974. };
  1975. }
  1976. function jsxExpressionContainer(expression) {
  1977. const node = {
  1978. type: "JSXExpressionContainer",
  1979. expression
  1980. };
  1981. const defs = NODE_FIELDS.JSXExpressionContainer;
  1982. validate(defs.expression, node, "expression", expression, 1);
  1983. return node;
  1984. }
  1985. function jsxSpreadChild(expression) {
  1986. const node = {
  1987. type: "JSXSpreadChild",
  1988. expression
  1989. };
  1990. const defs = NODE_FIELDS.JSXSpreadChild;
  1991. validate(defs.expression, node, "expression", expression, 1);
  1992. return node;
  1993. }
  1994. function jsxIdentifier(name) {
  1995. const node = {
  1996. type: "JSXIdentifier",
  1997. name
  1998. };
  1999. const defs = NODE_FIELDS.JSXIdentifier;
  2000. validate(defs.name, node, "name", name);
  2001. return node;
  2002. }
  2003. function jsxMemberExpression(object, property) {
  2004. const node = {
  2005. type: "JSXMemberExpression",
  2006. object,
  2007. property
  2008. };
  2009. const defs = NODE_FIELDS.JSXMemberExpression;
  2010. validate(defs.object, node, "object", object, 1);
  2011. validate(defs.property, node, "property", property, 1);
  2012. return node;
  2013. }
  2014. function jsxNamespacedName(namespace, name) {
  2015. const node = {
  2016. type: "JSXNamespacedName",
  2017. namespace,
  2018. name
  2019. };
  2020. const defs = NODE_FIELDS.JSXNamespacedName;
  2021. validate(defs.namespace, node, "namespace", namespace, 1);
  2022. validate(defs.name, node, "name", name, 1);
  2023. return node;
  2024. }
  2025. function jsxOpeningElement(name, attributes, selfClosing = false) {
  2026. const node = {
  2027. type: "JSXOpeningElement",
  2028. name,
  2029. attributes,
  2030. selfClosing
  2031. };
  2032. const defs = NODE_FIELDS.JSXOpeningElement;
  2033. validate(defs.name, node, "name", name, 1);
  2034. validate(defs.attributes, node, "attributes", attributes, 1);
  2035. validate(defs.selfClosing, node, "selfClosing", selfClosing);
  2036. return node;
  2037. }
  2038. function jsxSpreadAttribute(argument) {
  2039. const node = {
  2040. type: "JSXSpreadAttribute",
  2041. argument
  2042. };
  2043. const defs = NODE_FIELDS.JSXSpreadAttribute;
  2044. validate(defs.argument, node, "argument", argument, 1);
  2045. return node;
  2046. }
  2047. function jsxText(value) {
  2048. const node = {
  2049. type: "JSXText",
  2050. value
  2051. };
  2052. const defs = NODE_FIELDS.JSXText;
  2053. validate(defs.value, node, "value", value);
  2054. return node;
  2055. }
  2056. function jsxFragment(openingFragment, closingFragment, children) {
  2057. const node = {
  2058. type: "JSXFragment",
  2059. openingFragment,
  2060. closingFragment,
  2061. children
  2062. };
  2063. const defs = NODE_FIELDS.JSXFragment;
  2064. validate(defs.openingFragment, node, "openingFragment", openingFragment, 1);
  2065. validate(defs.closingFragment, node, "closingFragment", closingFragment, 1);
  2066. validate(defs.children, node, "children", children, 1);
  2067. return node;
  2068. }
  2069. function jsxOpeningFragment() {
  2070. return {
  2071. type: "JSXOpeningFragment"
  2072. };
  2073. }
  2074. function jsxClosingFragment() {
  2075. return {
  2076. type: "JSXClosingFragment"
  2077. };
  2078. }
  2079. function noop() {
  2080. return {
  2081. type: "Noop"
  2082. };
  2083. }
  2084. function placeholder(expectedNode, name) {
  2085. const node = {
  2086. type: "Placeholder",
  2087. expectedNode,
  2088. name
  2089. };
  2090. const defs = NODE_FIELDS.Placeholder;
  2091. validate(defs.expectedNode, node, "expectedNode", expectedNode);
  2092. validate(defs.name, node, "name", name, 1);
  2093. return node;
  2094. }
  2095. function v8IntrinsicIdentifier(name) {
  2096. const node = {
  2097. type: "V8IntrinsicIdentifier",
  2098. name
  2099. };
  2100. const defs = NODE_FIELDS.V8IntrinsicIdentifier;
  2101. validate(defs.name, node, "name", name);
  2102. return node;
  2103. }
  2104. function argumentPlaceholder() {
  2105. return {
  2106. type: "ArgumentPlaceholder"
  2107. };
  2108. }
  2109. function bindExpression(object, callee) {
  2110. const node = {
  2111. type: "BindExpression",
  2112. object,
  2113. callee
  2114. };
  2115. const defs = NODE_FIELDS.BindExpression;
  2116. validate(defs.object, node, "object", object, 1);
  2117. validate(defs.callee, node, "callee", callee, 1);
  2118. return node;
  2119. }
  2120. function decorator(expression) {
  2121. const node = {
  2122. type: "Decorator",
  2123. expression
  2124. };
  2125. const defs = NODE_FIELDS.Decorator;
  2126. validate(defs.expression, node, "expression", expression, 1);
  2127. return node;
  2128. }
  2129. function doExpression(body, async = false) {
  2130. const node = {
  2131. type: "DoExpression",
  2132. body,
  2133. async
  2134. };
  2135. const defs = NODE_FIELDS.DoExpression;
  2136. validate(defs.body, node, "body", body, 1);
  2137. validate(defs.async, node, "async", async);
  2138. return node;
  2139. }
  2140. function exportDefaultSpecifier(exported) {
  2141. const node = {
  2142. type: "ExportDefaultSpecifier",
  2143. exported
  2144. };
  2145. const defs = NODE_FIELDS.ExportDefaultSpecifier;
  2146. validate(defs.exported, node, "exported", exported, 1);
  2147. return node;
  2148. }
  2149. function recordExpression(properties) {
  2150. const node = {
  2151. type: "RecordExpression",
  2152. properties
  2153. };
  2154. const defs = NODE_FIELDS.RecordExpression;
  2155. validate(defs.properties, node, "properties", properties, 1);
  2156. return node;
  2157. }
  2158. function tupleExpression(elements = []) {
  2159. const node = {
  2160. type: "TupleExpression",
  2161. elements
  2162. };
  2163. const defs = NODE_FIELDS.TupleExpression;
  2164. validate(defs.elements, node, "elements", elements, 1);
  2165. return node;
  2166. }
  2167. function decimalLiteral(value) {
  2168. const node = {
  2169. type: "DecimalLiteral",
  2170. value
  2171. };
  2172. const defs = NODE_FIELDS.DecimalLiteral;
  2173. validate(defs.value, node, "value", value);
  2174. return node;
  2175. }
  2176. function moduleExpression(body) {
  2177. const node = {
  2178. type: "ModuleExpression",
  2179. body
  2180. };
  2181. const defs = NODE_FIELDS.ModuleExpression;
  2182. validate(defs.body, node, "body", body, 1);
  2183. return node;
  2184. }
  2185. function topicReference() {
  2186. return {
  2187. type: "TopicReference"
  2188. };
  2189. }
  2190. function pipelineTopicExpression(expression) {
  2191. const node = {
  2192. type: "PipelineTopicExpression",
  2193. expression
  2194. };
  2195. const defs = NODE_FIELDS.PipelineTopicExpression;
  2196. validate(defs.expression, node, "expression", expression, 1);
  2197. return node;
  2198. }
  2199. function pipelineBareFunction(callee) {
  2200. const node = {
  2201. type: "PipelineBareFunction",
  2202. callee
  2203. };
  2204. const defs = NODE_FIELDS.PipelineBareFunction;
  2205. validate(defs.callee, node, "callee", callee, 1);
  2206. return node;
  2207. }
  2208. function pipelinePrimaryTopicReference() {
  2209. return {
  2210. type: "PipelinePrimaryTopicReference"
  2211. };
  2212. }
  2213. function tsParameterProperty(parameter) {
  2214. const node = {
  2215. type: "TSParameterProperty",
  2216. parameter
  2217. };
  2218. const defs = NODE_FIELDS.TSParameterProperty;
  2219. validate(defs.parameter, node, "parameter", parameter, 1);
  2220. return node;
  2221. }
  2222. function tsDeclareFunction(id = null, typeParameters = null, params, returnType = null) {
  2223. const node = {
  2224. type: "TSDeclareFunction",
  2225. id,
  2226. typeParameters,
  2227. params,
  2228. returnType
  2229. };
  2230. const defs = NODE_FIELDS.TSDeclareFunction;
  2231. validate(defs.id, node, "id", id, 1);
  2232. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  2233. validate(defs.params, node, "params", params, 1);
  2234. validate(defs.returnType, node, "returnType", returnType, 1);
  2235. return node;
  2236. }
  2237. function tsDeclareMethod(decorators = null, key, typeParameters = null, params, returnType = null) {
  2238. const node = {
  2239. type: "TSDeclareMethod",
  2240. decorators,
  2241. key,
  2242. typeParameters,
  2243. params,
  2244. returnType
  2245. };
  2246. const defs = NODE_FIELDS.TSDeclareMethod;
  2247. validate(defs.decorators, node, "decorators", decorators, 1);
  2248. validate(defs.key, node, "key", key, 1);
  2249. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  2250. validate(defs.params, node, "params", params, 1);
  2251. validate(defs.returnType, node, "returnType", returnType, 1);
  2252. return node;
  2253. }
  2254. function tsQualifiedName(left, right) {
  2255. const node = {
  2256. type: "TSQualifiedName",
  2257. left,
  2258. right
  2259. };
  2260. const defs = NODE_FIELDS.TSQualifiedName;
  2261. validate(defs.left, node, "left", left, 1);
  2262. validate(defs.right, node, "right", right, 1);
  2263. return node;
  2264. }
  2265. function tsCallSignatureDeclaration(typeParameters = null, parameters, typeAnnotation = null) {
  2266. const node = {
  2267. type: "TSCallSignatureDeclaration",
  2268. typeParameters,
  2269. parameters,
  2270. typeAnnotation
  2271. };
  2272. const defs = NODE_FIELDS.TSCallSignatureDeclaration;
  2273. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  2274. validate(defs.parameters, node, "parameters", parameters, 1);
  2275. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  2276. return node;
  2277. }
  2278. function tsConstructSignatureDeclaration(typeParameters = null, parameters, typeAnnotation = null) {
  2279. const node = {
  2280. type: "TSConstructSignatureDeclaration",
  2281. typeParameters,
  2282. parameters,
  2283. typeAnnotation
  2284. };
  2285. const defs = NODE_FIELDS.TSConstructSignatureDeclaration;
  2286. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  2287. validate(defs.parameters, node, "parameters", parameters, 1);
  2288. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  2289. return node;
  2290. }
  2291. function tsPropertySignature(key, typeAnnotation = null) {
  2292. const node = {
  2293. type: "TSPropertySignature",
  2294. key,
  2295. typeAnnotation
  2296. };
  2297. const defs = NODE_FIELDS.TSPropertySignature;
  2298. validate(defs.key, node, "key", key, 1);
  2299. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  2300. return node;
  2301. }
  2302. function tsMethodSignature(key, typeParameters = null, parameters, typeAnnotation = null) {
  2303. const node = {
  2304. type: "TSMethodSignature",
  2305. key,
  2306. typeParameters,
  2307. parameters,
  2308. typeAnnotation,
  2309. kind: null
  2310. };
  2311. const defs = NODE_FIELDS.TSMethodSignature;
  2312. validate(defs.key, node, "key", key, 1);
  2313. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  2314. validate(defs.parameters, node, "parameters", parameters, 1);
  2315. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  2316. return node;
  2317. }
  2318. function tsIndexSignature(parameters, typeAnnotation = null) {
  2319. const node = {
  2320. type: "TSIndexSignature",
  2321. parameters,
  2322. typeAnnotation
  2323. };
  2324. const defs = NODE_FIELDS.TSIndexSignature;
  2325. validate(defs.parameters, node, "parameters", parameters, 1);
  2326. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  2327. return node;
  2328. }
  2329. function tsAnyKeyword() {
  2330. return {
  2331. type: "TSAnyKeyword"
  2332. };
  2333. }
  2334. function tsBooleanKeyword() {
  2335. return {
  2336. type: "TSBooleanKeyword"
  2337. };
  2338. }
  2339. function tsBigIntKeyword() {
  2340. return {
  2341. type: "TSBigIntKeyword"
  2342. };
  2343. }
  2344. function tsIntrinsicKeyword() {
  2345. return {
  2346. type: "TSIntrinsicKeyword"
  2347. };
  2348. }
  2349. function tsNeverKeyword() {
  2350. return {
  2351. type: "TSNeverKeyword"
  2352. };
  2353. }
  2354. function tsNullKeyword() {
  2355. return {
  2356. type: "TSNullKeyword"
  2357. };
  2358. }
  2359. function tsNumberKeyword() {
  2360. return {
  2361. type: "TSNumberKeyword"
  2362. };
  2363. }
  2364. function tsObjectKeyword() {
  2365. return {
  2366. type: "TSObjectKeyword"
  2367. };
  2368. }
  2369. function tsStringKeyword() {
  2370. return {
  2371. type: "TSStringKeyword"
  2372. };
  2373. }
  2374. function tsSymbolKeyword() {
  2375. return {
  2376. type: "TSSymbolKeyword"
  2377. };
  2378. }
  2379. function tsUndefinedKeyword() {
  2380. return {
  2381. type: "TSUndefinedKeyword"
  2382. };
  2383. }
  2384. function tsUnknownKeyword() {
  2385. return {
  2386. type: "TSUnknownKeyword"
  2387. };
  2388. }
  2389. function tsVoidKeyword() {
  2390. return {
  2391. type: "TSVoidKeyword"
  2392. };
  2393. }
  2394. function tsThisType() {
  2395. return {
  2396. type: "TSThisType"
  2397. };
  2398. }
  2399. function tsFunctionType(typeParameters = null, parameters, typeAnnotation = null) {
  2400. const node = {
  2401. type: "TSFunctionType",
  2402. typeParameters,
  2403. parameters,
  2404. typeAnnotation
  2405. };
  2406. const defs = NODE_FIELDS.TSFunctionType;
  2407. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  2408. validate(defs.parameters, node, "parameters", parameters, 1);
  2409. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  2410. return node;
  2411. }
  2412. function tsConstructorType(typeParameters = null, parameters, typeAnnotation = null) {
  2413. const node = {
  2414. type: "TSConstructorType",
  2415. typeParameters,
  2416. parameters,
  2417. typeAnnotation
  2418. };
  2419. const defs = NODE_FIELDS.TSConstructorType;
  2420. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  2421. validate(defs.parameters, node, "parameters", parameters, 1);
  2422. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  2423. return node;
  2424. }
  2425. function tsTypeReference(typeName, typeParameters = null) {
  2426. const node = {
  2427. type: "TSTypeReference",
  2428. typeName,
  2429. typeParameters
  2430. };
  2431. const defs = NODE_FIELDS.TSTypeReference;
  2432. validate(defs.typeName, node, "typeName", typeName, 1);
  2433. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  2434. return node;
  2435. }
  2436. function tsTypePredicate(parameterName, typeAnnotation = null, asserts = null) {
  2437. const node = {
  2438. type: "TSTypePredicate",
  2439. parameterName,
  2440. typeAnnotation,
  2441. asserts
  2442. };
  2443. const defs = NODE_FIELDS.TSTypePredicate;
  2444. validate(defs.parameterName, node, "parameterName", parameterName, 1);
  2445. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  2446. validate(defs.asserts, node, "asserts", asserts);
  2447. return node;
  2448. }
  2449. function tsTypeQuery(exprName, typeParameters = null) {
  2450. const node = {
  2451. type: "TSTypeQuery",
  2452. exprName,
  2453. typeParameters
  2454. };
  2455. const defs = NODE_FIELDS.TSTypeQuery;
  2456. validate(defs.exprName, node, "exprName", exprName, 1);
  2457. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  2458. return node;
  2459. }
  2460. function tsTypeLiteral(members) {
  2461. const node = {
  2462. type: "TSTypeLiteral",
  2463. members
  2464. };
  2465. const defs = NODE_FIELDS.TSTypeLiteral;
  2466. validate(defs.members, node, "members", members, 1);
  2467. return node;
  2468. }
  2469. function tsArrayType(elementType) {
  2470. const node = {
  2471. type: "TSArrayType",
  2472. elementType
  2473. };
  2474. const defs = NODE_FIELDS.TSArrayType;
  2475. validate(defs.elementType, node, "elementType", elementType, 1);
  2476. return node;
  2477. }
  2478. function tsTupleType(elementTypes) {
  2479. const node = {
  2480. type: "TSTupleType",
  2481. elementTypes
  2482. };
  2483. const defs = NODE_FIELDS.TSTupleType;
  2484. validate(defs.elementTypes, node, "elementTypes", elementTypes, 1);
  2485. return node;
  2486. }
  2487. function tsOptionalType(typeAnnotation) {
  2488. const node = {
  2489. type: "TSOptionalType",
  2490. typeAnnotation
  2491. };
  2492. const defs = NODE_FIELDS.TSOptionalType;
  2493. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  2494. return node;
  2495. }
  2496. function tsRestType(typeAnnotation) {
  2497. const node = {
  2498. type: "TSRestType",
  2499. typeAnnotation
  2500. };
  2501. const defs = NODE_FIELDS.TSRestType;
  2502. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  2503. return node;
  2504. }
  2505. function tsNamedTupleMember(label, elementType, optional = false) {
  2506. const node = {
  2507. type: "TSNamedTupleMember",
  2508. label,
  2509. elementType,
  2510. optional
  2511. };
  2512. const defs = NODE_FIELDS.TSNamedTupleMember;
  2513. validate(defs.label, node, "label", label, 1);
  2514. validate(defs.elementType, node, "elementType", elementType, 1);
  2515. validate(defs.optional, node, "optional", optional);
  2516. return node;
  2517. }
  2518. function tsUnionType(types) {
  2519. const node = {
  2520. type: "TSUnionType",
  2521. types
  2522. };
  2523. const defs = NODE_FIELDS.TSUnionType;
  2524. validate(defs.types, node, "types", types, 1);
  2525. return node;
  2526. }
  2527. function tsIntersectionType(types) {
  2528. const node = {
  2529. type: "TSIntersectionType",
  2530. types
  2531. };
  2532. const defs = NODE_FIELDS.TSIntersectionType;
  2533. validate(defs.types, node, "types", types, 1);
  2534. return node;
  2535. }
  2536. function tsConditionalType(checkType, extendsType, trueType, falseType) {
  2537. const node = {
  2538. type: "TSConditionalType",
  2539. checkType,
  2540. extendsType,
  2541. trueType,
  2542. falseType
  2543. };
  2544. const defs = NODE_FIELDS.TSConditionalType;
  2545. validate(defs.checkType, node, "checkType", checkType, 1);
  2546. validate(defs.extendsType, node, "extendsType", extendsType, 1);
  2547. validate(defs.trueType, node, "trueType", trueType, 1);
  2548. validate(defs.falseType, node, "falseType", falseType, 1);
  2549. return node;
  2550. }
  2551. function tsInferType(typeParameter) {
  2552. const node = {
  2553. type: "TSInferType",
  2554. typeParameter
  2555. };
  2556. const defs = NODE_FIELDS.TSInferType;
  2557. validate(defs.typeParameter, node, "typeParameter", typeParameter, 1);
  2558. return node;
  2559. }
  2560. function tsParenthesizedType(typeAnnotation) {
  2561. const node = {
  2562. type: "TSParenthesizedType",
  2563. typeAnnotation
  2564. };
  2565. const defs = NODE_FIELDS.TSParenthesizedType;
  2566. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  2567. return node;
  2568. }
  2569. function tsTypeOperator(typeAnnotation) {
  2570. const node = {
  2571. type: "TSTypeOperator",
  2572. typeAnnotation,
  2573. operator: null
  2574. };
  2575. const defs = NODE_FIELDS.TSTypeOperator;
  2576. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  2577. return node;
  2578. }
  2579. function tsIndexedAccessType(objectType, indexType) {
  2580. const node = {
  2581. type: "TSIndexedAccessType",
  2582. objectType,
  2583. indexType
  2584. };
  2585. const defs = NODE_FIELDS.TSIndexedAccessType;
  2586. validate(defs.objectType, node, "objectType", objectType, 1);
  2587. validate(defs.indexType, node, "indexType", indexType, 1);
  2588. return node;
  2589. }
  2590. function tsMappedType(typeParameter, typeAnnotation = null, nameType = null) {
  2591. const node = {
  2592. type: "TSMappedType",
  2593. typeParameter,
  2594. typeAnnotation,
  2595. nameType
  2596. };
  2597. const defs = NODE_FIELDS.TSMappedType;
  2598. validate(defs.typeParameter, node, "typeParameter", typeParameter, 1);
  2599. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  2600. validate(defs.nameType, node, "nameType", nameType, 1);
  2601. return node;
  2602. }
  2603. function tsTemplateLiteralType(quasis, types) {
  2604. const node = {
  2605. type: "TSTemplateLiteralType",
  2606. quasis,
  2607. types
  2608. };
  2609. const defs = NODE_FIELDS.TSTemplateLiteralType;
  2610. validate(defs.quasis, node, "quasis", quasis, 1);
  2611. validate(defs.types, node, "types", types, 1);
  2612. return node;
  2613. }
  2614. function tsLiteralType(literal) {
  2615. const node = {
  2616. type: "TSLiteralType",
  2617. literal
  2618. };
  2619. const defs = NODE_FIELDS.TSLiteralType;
  2620. validate(defs.literal, node, "literal", literal, 1);
  2621. return node;
  2622. }
  2623. function tsExpressionWithTypeArguments(expression, typeParameters = null) {
  2624. const node = {
  2625. type: "TSExpressionWithTypeArguments",
  2626. expression,
  2627. typeParameters
  2628. };
  2629. const defs = NODE_FIELDS.TSExpressionWithTypeArguments;
  2630. validate(defs.expression, node, "expression", expression, 1);
  2631. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  2632. return node;
  2633. }
  2634. function tsInterfaceDeclaration(id, typeParameters = null, _extends = null, body) {
  2635. const node = {
  2636. type: "TSInterfaceDeclaration",
  2637. id,
  2638. typeParameters,
  2639. extends: _extends,
  2640. body
  2641. };
  2642. const defs = NODE_FIELDS.TSInterfaceDeclaration;
  2643. validate(defs.id, node, "id", id, 1);
  2644. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  2645. validate(defs.extends, node, "extends", _extends, 1);
  2646. validate(defs.body, node, "body", body, 1);
  2647. return node;
  2648. }
  2649. function tsInterfaceBody(body) {
  2650. const node = {
  2651. type: "TSInterfaceBody",
  2652. body
  2653. };
  2654. const defs = NODE_FIELDS.TSInterfaceBody;
  2655. validate(defs.body, node, "body", body, 1);
  2656. return node;
  2657. }
  2658. function tsTypeAliasDeclaration(id, typeParameters = null, typeAnnotation) {
  2659. const node = {
  2660. type: "TSTypeAliasDeclaration",
  2661. id,
  2662. typeParameters,
  2663. typeAnnotation
  2664. };
  2665. const defs = NODE_FIELDS.TSTypeAliasDeclaration;
  2666. validate(defs.id, node, "id", id, 1);
  2667. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  2668. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  2669. return node;
  2670. }
  2671. function tsInstantiationExpression(expression, typeParameters = null) {
  2672. const node = {
  2673. type: "TSInstantiationExpression",
  2674. expression,
  2675. typeParameters
  2676. };
  2677. const defs = NODE_FIELDS.TSInstantiationExpression;
  2678. validate(defs.expression, node, "expression", expression, 1);
  2679. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  2680. return node;
  2681. }
  2682. function tsAsExpression(expression, typeAnnotation) {
  2683. const node = {
  2684. type: "TSAsExpression",
  2685. expression,
  2686. typeAnnotation
  2687. };
  2688. const defs = NODE_FIELDS.TSAsExpression;
  2689. validate(defs.expression, node, "expression", expression, 1);
  2690. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  2691. return node;
  2692. }
  2693. function tsSatisfiesExpression(expression, typeAnnotation) {
  2694. const node = {
  2695. type: "TSSatisfiesExpression",
  2696. expression,
  2697. typeAnnotation
  2698. };
  2699. const defs = NODE_FIELDS.TSSatisfiesExpression;
  2700. validate(defs.expression, node, "expression", expression, 1);
  2701. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  2702. return node;
  2703. }
  2704. function tsTypeAssertion(typeAnnotation, expression) {
  2705. const node = {
  2706. type: "TSTypeAssertion",
  2707. typeAnnotation,
  2708. expression
  2709. };
  2710. const defs = NODE_FIELDS.TSTypeAssertion;
  2711. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  2712. validate(defs.expression, node, "expression", expression, 1);
  2713. return node;
  2714. }
  2715. function tsEnumBody(members) {
  2716. const node = {
  2717. type: "TSEnumBody",
  2718. members
  2719. };
  2720. const defs = NODE_FIELDS.TSEnumBody;
  2721. validate(defs.members, node, "members", members, 1);
  2722. return node;
  2723. }
  2724. function tsEnumDeclaration(id, members) {
  2725. const node = {
  2726. type: "TSEnumDeclaration",
  2727. id,
  2728. members
  2729. };
  2730. const defs = NODE_FIELDS.TSEnumDeclaration;
  2731. validate(defs.id, node, "id", id, 1);
  2732. validate(defs.members, node, "members", members, 1);
  2733. return node;
  2734. }
  2735. function tsEnumMember(id, initializer = null) {
  2736. const node = {
  2737. type: "TSEnumMember",
  2738. id,
  2739. initializer
  2740. };
  2741. const defs = NODE_FIELDS.TSEnumMember;
  2742. validate(defs.id, node, "id", id, 1);
  2743. validate(defs.initializer, node, "initializer", initializer, 1);
  2744. return node;
  2745. }
  2746. function tsModuleDeclaration(id, body) {
  2747. const node = {
  2748. type: "TSModuleDeclaration",
  2749. id,
  2750. body,
  2751. kind: null
  2752. };
  2753. const defs = NODE_FIELDS.TSModuleDeclaration;
  2754. validate(defs.id, node, "id", id, 1);
  2755. validate(defs.body, node, "body", body, 1);
  2756. return node;
  2757. }
  2758. function tsModuleBlock(body) {
  2759. const node = {
  2760. type: "TSModuleBlock",
  2761. body
  2762. };
  2763. const defs = NODE_FIELDS.TSModuleBlock;
  2764. validate(defs.body, node, "body", body, 1);
  2765. return node;
  2766. }
  2767. function tsImportType(argument, qualifier = null, typeParameters = null) {
  2768. const node = {
  2769. type: "TSImportType",
  2770. argument,
  2771. qualifier,
  2772. typeParameters
  2773. };
  2774. const defs = NODE_FIELDS.TSImportType;
  2775. validate(defs.argument, node, "argument", argument, 1);
  2776. validate(defs.qualifier, node, "qualifier", qualifier, 1);
  2777. validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
  2778. return node;
  2779. }
  2780. function tsImportEqualsDeclaration(id, moduleReference) {
  2781. const node = {
  2782. type: "TSImportEqualsDeclaration",
  2783. id,
  2784. moduleReference,
  2785. isExport: null
  2786. };
  2787. const defs = NODE_FIELDS.TSImportEqualsDeclaration;
  2788. validate(defs.id, node, "id", id, 1);
  2789. validate(defs.moduleReference, node, "moduleReference", moduleReference, 1);
  2790. return node;
  2791. }
  2792. function tsExternalModuleReference(expression) {
  2793. const node = {
  2794. type: "TSExternalModuleReference",
  2795. expression
  2796. };
  2797. const defs = NODE_FIELDS.TSExternalModuleReference;
  2798. validate(defs.expression, node, "expression", expression, 1);
  2799. return node;
  2800. }
  2801. function tsNonNullExpression(expression) {
  2802. const node = {
  2803. type: "TSNonNullExpression",
  2804. expression
  2805. };
  2806. const defs = NODE_FIELDS.TSNonNullExpression;
  2807. validate(defs.expression, node, "expression", expression, 1);
  2808. return node;
  2809. }
  2810. function tsExportAssignment(expression) {
  2811. const node = {
  2812. type: "TSExportAssignment",
  2813. expression
  2814. };
  2815. const defs = NODE_FIELDS.TSExportAssignment;
  2816. validate(defs.expression, node, "expression", expression, 1);
  2817. return node;
  2818. }
  2819. function tsNamespaceExportDeclaration(id) {
  2820. const node = {
  2821. type: "TSNamespaceExportDeclaration",
  2822. id
  2823. };
  2824. const defs = NODE_FIELDS.TSNamespaceExportDeclaration;
  2825. validate(defs.id, node, "id", id, 1);
  2826. return node;
  2827. }
  2828. function tsTypeAnnotation(typeAnnotation) {
  2829. const node = {
  2830. type: "TSTypeAnnotation",
  2831. typeAnnotation
  2832. };
  2833. const defs = NODE_FIELDS.TSTypeAnnotation;
  2834. validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
  2835. return node;
  2836. }
  2837. function tsTypeParameterInstantiation(params) {
  2838. const node = {
  2839. type: "TSTypeParameterInstantiation",
  2840. params
  2841. };
  2842. const defs = NODE_FIELDS.TSTypeParameterInstantiation;
  2843. validate(defs.params, node, "params", params, 1);
  2844. return node;
  2845. }
  2846. function tsTypeParameterDeclaration(params) {
  2847. const node = {
  2848. type: "TSTypeParameterDeclaration",
  2849. params
  2850. };
  2851. const defs = NODE_FIELDS.TSTypeParameterDeclaration;
  2852. validate(defs.params, node, "params", params, 1);
  2853. return node;
  2854. }
  2855. function tsTypeParameter(constraint = null, _default = null, name) {
  2856. const node = {
  2857. type: "TSTypeParameter",
  2858. constraint,
  2859. default: _default,
  2860. name
  2861. };
  2862. const defs = NODE_FIELDS.TSTypeParameter;
  2863. validate(defs.constraint, node, "constraint", constraint, 1);
  2864. validate(defs.default, node, "default", _default, 1);
  2865. validate(defs.name, node, "name", name);
  2866. return node;
  2867. }
  2868. function NumberLiteral(value) {
  2869. (0, _deprecationWarning.default)("NumberLiteral", "NumericLiteral", "The node type ");
  2870. return numericLiteral(value);
  2871. }
  2872. function RegexLiteral(pattern, flags = "") {
  2873. (0, _deprecationWarning.default)("RegexLiteral", "RegExpLiteral", "The node type ");
  2874. return regExpLiteral(pattern, flags);
  2875. }
  2876. function RestProperty(argument) {
  2877. (0, _deprecationWarning.default)("RestProperty", "RestElement", "The node type ");
  2878. return restElement(argument);
  2879. }
  2880. function SpreadProperty(argument) {
  2881. (0, _deprecationWarning.default)("SpreadProperty", "SpreadElement", "The node type ");
  2882. return spreadElement(argument);
  2883. }
  2884. //# sourceMappingURL=lowercase.js.map