0bac08f5238b30ddaf9f87a4beb4b8d3abb798af0b578ab7b04227b1839242f456c126205f60276bfec596386833eefbf415b933f8d6b80f87889c0989c3c6 83 KB

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