You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

nodes.d.ts 50KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265
  1. import { Omit } from "../types";
  2. import * as K from "./kinds";
  3. export interface Printable {
  4. loc: K.SourceLocationKind | null;
  5. }
  6. export interface SourceLocation {
  7. start: K.PositionKind;
  8. end: K.PositionKind;
  9. source: string | null;
  10. }
  11. export interface Node extends Printable {
  12. type: string;
  13. comments: K.CommentKind[] | null;
  14. }
  15. export interface Comment extends Printable {
  16. value: string;
  17. leading: boolean;
  18. trailing: boolean;
  19. }
  20. export interface Position {
  21. line: number;
  22. column: number;
  23. }
  24. export interface File extends Omit<Node, "type"> {
  25. type: "File";
  26. program: K.ProgramKind;
  27. name: string | null;
  28. }
  29. export interface Program extends Omit<Node, "type"> {
  30. type: "Program";
  31. body: K.StatementKind[];
  32. directives: K.DirectiveKind[];
  33. interpreter: K.InterpreterDirectiveKind | null;
  34. }
  35. export interface Statement extends Node {
  36. }
  37. export interface Function extends Node {
  38. id: K.IdentifierKind | null;
  39. params: K.PatternKind[];
  40. body: K.BlockStatementKind;
  41. generator: boolean;
  42. async: boolean;
  43. expression: boolean;
  44. defaults: (K.ExpressionKind | null)[];
  45. rest: K.IdentifierKind | null;
  46. returnType: K.TypeAnnotationKind | K.TSTypeAnnotationKind | null;
  47. typeParameters: K.TypeParameterDeclarationKind | K.TSTypeParameterDeclarationKind | null;
  48. }
  49. export interface Expression extends Node {
  50. }
  51. export interface Pattern extends Node {
  52. }
  53. export interface Identifier extends Omit<Expression, "type">, Omit<Pattern, "type"> {
  54. type: "Identifier";
  55. name: string;
  56. optional: boolean;
  57. typeAnnotation: K.TypeAnnotationKind | K.TSTypeAnnotationKind | null;
  58. }
  59. export interface BlockStatement extends Omit<Statement, "type"> {
  60. type: "BlockStatement";
  61. body: K.StatementKind[];
  62. directives: K.DirectiveKind[];
  63. }
  64. export interface EmptyStatement extends Omit<Statement, "type"> {
  65. type: "EmptyStatement";
  66. }
  67. export interface ExpressionStatement extends Omit<Statement, "type"> {
  68. type: "ExpressionStatement";
  69. expression: K.ExpressionKind;
  70. }
  71. export interface IfStatement extends Omit<Statement, "type"> {
  72. type: "IfStatement";
  73. test: K.ExpressionKind;
  74. consequent: K.StatementKind;
  75. alternate: K.StatementKind | null;
  76. }
  77. export interface LabeledStatement extends Omit<Statement, "type"> {
  78. type: "LabeledStatement";
  79. label: K.IdentifierKind;
  80. body: K.StatementKind;
  81. }
  82. export interface BreakStatement extends Omit<Statement, "type"> {
  83. type: "BreakStatement";
  84. label: K.IdentifierKind | null;
  85. }
  86. export interface ContinueStatement extends Omit<Statement, "type"> {
  87. type: "ContinueStatement";
  88. label: K.IdentifierKind | null;
  89. }
  90. export interface WithStatement extends Omit<Statement, "type"> {
  91. type: "WithStatement";
  92. object: K.ExpressionKind;
  93. body: K.StatementKind;
  94. }
  95. export interface SwitchStatement extends Omit<Statement, "type"> {
  96. type: "SwitchStatement";
  97. discriminant: K.ExpressionKind;
  98. cases: K.SwitchCaseKind[];
  99. lexical: boolean;
  100. }
  101. export interface SwitchCase extends Omit<Node, "type"> {
  102. type: "SwitchCase";
  103. test: K.ExpressionKind | null;
  104. consequent: K.StatementKind[];
  105. }
  106. export interface ReturnStatement extends Omit<Statement, "type"> {
  107. type: "ReturnStatement";
  108. argument: K.ExpressionKind | null;
  109. }
  110. export interface ThrowStatement extends Omit<Statement, "type"> {
  111. type: "ThrowStatement";
  112. argument: K.ExpressionKind;
  113. }
  114. export interface TryStatement extends Omit<Statement, "type"> {
  115. type: "TryStatement";
  116. block: K.BlockStatementKind;
  117. handler: K.CatchClauseKind | null;
  118. handlers: K.CatchClauseKind[];
  119. guardedHandlers: K.CatchClauseKind[];
  120. finalizer: K.BlockStatementKind | null;
  121. }
  122. export interface CatchClause extends Omit<Node, "type"> {
  123. type: "CatchClause";
  124. param: K.PatternKind | null;
  125. guard: K.ExpressionKind | null;
  126. body: K.BlockStatementKind;
  127. }
  128. export interface WhileStatement extends Omit<Statement, "type"> {
  129. type: "WhileStatement";
  130. test: K.ExpressionKind;
  131. body: K.StatementKind;
  132. }
  133. export interface DoWhileStatement extends Omit<Statement, "type"> {
  134. type: "DoWhileStatement";
  135. body: K.StatementKind;
  136. test: K.ExpressionKind;
  137. }
  138. export interface ForStatement extends Omit<Statement, "type"> {
  139. type: "ForStatement";
  140. init: K.VariableDeclarationKind | K.ExpressionKind | null;
  141. test: K.ExpressionKind | null;
  142. update: K.ExpressionKind | null;
  143. body: K.StatementKind;
  144. }
  145. export interface Declaration extends Statement {
  146. }
  147. export interface VariableDeclaration extends Omit<Declaration, "type"> {
  148. type: "VariableDeclaration";
  149. kind: "var" | "let" | "const";
  150. declarations: (K.VariableDeclaratorKind | K.IdentifierKind)[];
  151. }
  152. export interface ForInStatement extends Omit<Statement, "type"> {
  153. type: "ForInStatement";
  154. left: K.VariableDeclarationKind | K.ExpressionKind;
  155. right: K.ExpressionKind;
  156. body: K.StatementKind;
  157. }
  158. export interface DebuggerStatement extends Omit<Statement, "type"> {
  159. type: "DebuggerStatement";
  160. }
  161. export interface FunctionDeclaration extends Omit<Function, "type" | "id">, Omit<Declaration, "type"> {
  162. type: "FunctionDeclaration";
  163. id: K.IdentifierKind;
  164. }
  165. export interface FunctionExpression extends Omit<Function, "type">, Omit<Expression, "type"> {
  166. type: "FunctionExpression";
  167. }
  168. export interface VariableDeclarator extends Omit<Node, "type"> {
  169. type: "VariableDeclarator";
  170. id: K.PatternKind;
  171. init: K.ExpressionKind | null;
  172. }
  173. export interface ThisExpression extends Omit<Expression, "type"> {
  174. type: "ThisExpression";
  175. }
  176. export interface ArrayExpression extends Omit<Expression, "type"> {
  177. type: "ArrayExpression";
  178. elements: (K.ExpressionKind | K.SpreadElementKind | K.RestElementKind | null)[];
  179. }
  180. export interface ObjectExpression extends Omit<Expression, "type"> {
  181. type: "ObjectExpression";
  182. properties: (K.PropertyKind | K.ObjectMethodKind | K.ObjectPropertyKind | K.SpreadPropertyKind | K.SpreadElementKind)[];
  183. }
  184. export interface Property extends Omit<Node, "type"> {
  185. type: "Property";
  186. kind: "init" | "get" | "set";
  187. key: K.LiteralKind | K.IdentifierKind | K.ExpressionKind;
  188. value: K.ExpressionKind | K.PatternKind;
  189. method: boolean;
  190. shorthand: boolean;
  191. computed: boolean;
  192. decorators: K.DecoratorKind[] | null;
  193. }
  194. export interface Literal extends Omit<Expression, "type"> {
  195. type: "Literal";
  196. value: string | boolean | null | number | RegExp;
  197. regex: {
  198. pattern: string;
  199. flags: string;
  200. } | null;
  201. }
  202. export interface SequenceExpression extends Omit<Expression, "type"> {
  203. type: "SequenceExpression";
  204. expressions: K.ExpressionKind[];
  205. }
  206. export interface UnaryExpression extends Omit<Expression, "type"> {
  207. type: "UnaryExpression";
  208. operator: "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
  209. argument: K.ExpressionKind;
  210. prefix: boolean;
  211. }
  212. export interface BinaryExpression extends Omit<Expression, "type"> {
  213. type: "BinaryExpression";
  214. operator: "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "&" | "|" | "^" | "in" | "instanceof";
  215. left: K.ExpressionKind;
  216. right: K.ExpressionKind;
  217. }
  218. export interface AssignmentExpression extends Omit<Expression, "type"> {
  219. type: "AssignmentExpression";
  220. operator: "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=";
  221. left: K.PatternKind | K.MemberExpressionKind;
  222. right: K.ExpressionKind;
  223. }
  224. export interface MemberExpression extends Omit<Expression, "type"> {
  225. type: "MemberExpression";
  226. object: K.ExpressionKind;
  227. property: K.IdentifierKind | K.ExpressionKind;
  228. computed: boolean;
  229. }
  230. export interface UpdateExpression extends Omit<Expression, "type"> {
  231. type: "UpdateExpression";
  232. operator: "++" | "--";
  233. argument: K.ExpressionKind;
  234. prefix: boolean;
  235. }
  236. export interface LogicalExpression extends Omit<Expression, "type"> {
  237. type: "LogicalExpression";
  238. operator: "||" | "&&" | "??";
  239. left: K.ExpressionKind;
  240. right: K.ExpressionKind;
  241. }
  242. export interface ConditionalExpression extends Omit<Expression, "type"> {
  243. type: "ConditionalExpression";
  244. test: K.ExpressionKind;
  245. consequent: K.ExpressionKind;
  246. alternate: K.ExpressionKind;
  247. }
  248. export interface NewExpression extends Omit<Expression, "type"> {
  249. type: "NewExpression";
  250. callee: K.ExpressionKind;
  251. arguments: (K.ExpressionKind | K.SpreadElementKind)[];
  252. }
  253. export interface CallExpression extends Omit<Expression, "type"> {
  254. type: "CallExpression";
  255. callee: K.ExpressionKind;
  256. arguments: (K.ExpressionKind | K.SpreadElementKind)[];
  257. }
  258. export interface RestElement extends Omit<Pattern, "type"> {
  259. type: "RestElement";
  260. argument: K.PatternKind;
  261. typeAnnotation: K.TypeAnnotationKind | K.TSTypeAnnotationKind | null;
  262. }
  263. export interface TypeAnnotation extends Omit<Node, "type"> {
  264. type: "TypeAnnotation";
  265. typeAnnotation: K.FlowTypeKind;
  266. }
  267. export interface TSTypeAnnotation extends Omit<Node, "type"> {
  268. type: "TSTypeAnnotation";
  269. typeAnnotation: K.TSTypeKind | K.TSTypeAnnotationKind;
  270. }
  271. export interface SpreadElementPattern extends Omit<Pattern, "type"> {
  272. type: "SpreadElementPattern";
  273. argument: K.PatternKind;
  274. }
  275. export interface ArrowFunctionExpression extends Omit<Function, "type" | "id" | "body" | "generator">, Omit<Expression, "type"> {
  276. type: "ArrowFunctionExpression";
  277. id: null;
  278. body: K.BlockStatementKind | K.ExpressionKind;
  279. generator: false;
  280. }
  281. export interface ForOfStatement extends Omit<Statement, "type"> {
  282. type: "ForOfStatement";
  283. left: K.VariableDeclarationKind | K.PatternKind;
  284. right: K.ExpressionKind;
  285. body: K.StatementKind;
  286. }
  287. export interface YieldExpression extends Omit<Expression, "type"> {
  288. type: "YieldExpression";
  289. argument: K.ExpressionKind | null;
  290. delegate: boolean;
  291. }
  292. export interface GeneratorExpression extends Omit<Expression, "type"> {
  293. type: "GeneratorExpression";
  294. body: K.ExpressionKind;
  295. blocks: K.ComprehensionBlockKind[];
  296. filter: K.ExpressionKind | null;
  297. }
  298. export interface ComprehensionBlock extends Omit<Node, "type"> {
  299. type: "ComprehensionBlock";
  300. left: K.PatternKind;
  301. right: K.ExpressionKind;
  302. each: boolean;
  303. }
  304. export interface ComprehensionExpression extends Omit<Expression, "type"> {
  305. type: "ComprehensionExpression";
  306. body: K.ExpressionKind;
  307. blocks: K.ComprehensionBlockKind[];
  308. filter: K.ExpressionKind | null;
  309. }
  310. export interface ObjectProperty extends Omit<Node, "type"> {
  311. shorthand: boolean;
  312. type: "ObjectProperty";
  313. key: K.LiteralKind | K.IdentifierKind | K.ExpressionKind;
  314. value: K.ExpressionKind | K.PatternKind;
  315. accessibility: K.LiteralKind | null;
  316. computed: boolean;
  317. }
  318. export interface PropertyPattern extends Omit<Pattern, "type"> {
  319. type: "PropertyPattern";
  320. key: K.LiteralKind | K.IdentifierKind | K.ExpressionKind;
  321. pattern: K.PatternKind;
  322. computed: boolean;
  323. }
  324. export interface ObjectPattern extends Omit<Pattern, "type"> {
  325. type: "ObjectPattern";
  326. properties: (K.PropertyKind | K.PropertyPatternKind | K.SpreadPropertyPatternKind | K.SpreadPropertyKind | K.ObjectPropertyKind | K.RestPropertyKind)[];
  327. typeAnnotation: K.TypeAnnotationKind | K.TSTypeAnnotationKind | null;
  328. decorators: K.DecoratorKind[] | null;
  329. }
  330. export interface ArrayPattern extends Omit<Pattern, "type"> {
  331. type: "ArrayPattern";
  332. elements: (K.PatternKind | K.SpreadElementKind | null)[];
  333. }
  334. export interface MethodDefinition extends Omit<Declaration, "type"> {
  335. type: "MethodDefinition";
  336. kind: "constructor" | "method" | "get" | "set";
  337. key: K.ExpressionKind;
  338. value: K.FunctionKind;
  339. computed: boolean;
  340. static: boolean;
  341. decorators: K.DecoratorKind[] | null;
  342. }
  343. export interface SpreadElement extends Omit<Node, "type"> {
  344. type: "SpreadElement";
  345. argument: K.ExpressionKind;
  346. }
  347. export interface AssignmentPattern extends Omit<Pattern, "type"> {
  348. type: "AssignmentPattern";
  349. left: K.PatternKind;
  350. right: K.ExpressionKind;
  351. }
  352. export interface ClassPropertyDefinition extends Omit<Declaration, "type"> {
  353. type: "ClassPropertyDefinition";
  354. definition: K.MethodDefinitionKind | K.VariableDeclaratorKind | K.ClassPropertyDefinitionKind | K.ClassPropertyKind;
  355. }
  356. export interface ClassProperty extends Omit<Declaration, "type"> {
  357. type: "ClassProperty";
  358. key: K.LiteralKind | K.IdentifierKind | K.ExpressionKind;
  359. computed: boolean;
  360. value: K.ExpressionKind | null;
  361. static: boolean;
  362. typeAnnotation: K.TypeAnnotationKind | K.TSTypeAnnotationKind | null;
  363. variance: K.VarianceKind | "plus" | "minus" | null;
  364. access: "public" | "private" | "protected" | undefined;
  365. }
  366. export interface ClassBody extends Omit<Declaration, "type"> {
  367. type: "ClassBody";
  368. body: (K.MethodDefinitionKind | K.VariableDeclaratorKind | K.ClassPropertyDefinitionKind | K.ClassPropertyKind | K.ClassPrivatePropertyKind | K.ClassMethodKind | K.ClassPrivateMethodKind | K.TSDeclareMethodKind | K.TSCallSignatureDeclarationKind | K.TSConstructSignatureDeclarationKind | K.TSIndexSignatureKind | K.TSMethodSignatureKind | K.TSPropertySignatureKind)[];
  369. }
  370. export interface ClassDeclaration extends Omit<Declaration, "type"> {
  371. type: "ClassDeclaration";
  372. id: K.IdentifierKind | null;
  373. body: K.ClassBodyKind;
  374. superClass: K.ExpressionKind | null;
  375. typeParameters: K.TypeParameterDeclarationKind | K.TSTypeParameterDeclarationKind | null;
  376. superTypeParameters: K.TypeParameterInstantiationKind | K.TSTypeParameterInstantiationKind | null;
  377. implements: K.ClassImplementsKind[] | K.TSExpressionWithTypeArgumentsKind[];
  378. }
  379. export interface ClassExpression extends Omit<Expression, "type"> {
  380. type: "ClassExpression";
  381. id: K.IdentifierKind | null;
  382. body: K.ClassBodyKind;
  383. superClass: K.ExpressionKind | null;
  384. typeParameters: K.TypeParameterDeclarationKind | K.TSTypeParameterDeclarationKind | null;
  385. superTypeParameters: K.TypeParameterInstantiationKind | K.TSTypeParameterInstantiationKind | null;
  386. implements: K.ClassImplementsKind[] | K.TSExpressionWithTypeArgumentsKind[];
  387. }
  388. export interface Specifier extends Node {
  389. }
  390. export interface ModuleSpecifier extends Specifier {
  391. local: K.IdentifierKind | null;
  392. id: K.IdentifierKind | null;
  393. name: K.IdentifierKind | null;
  394. }
  395. export interface ImportSpecifier extends Omit<ModuleSpecifier, "type"> {
  396. type: "ImportSpecifier";
  397. imported: K.IdentifierKind;
  398. }
  399. export interface ImportNamespaceSpecifier extends Omit<ModuleSpecifier, "type"> {
  400. type: "ImportNamespaceSpecifier";
  401. }
  402. export interface ImportDefaultSpecifier extends Omit<ModuleSpecifier, "type"> {
  403. type: "ImportDefaultSpecifier";
  404. }
  405. export interface ImportDeclaration extends Omit<Declaration, "type"> {
  406. type: "ImportDeclaration";
  407. specifiers: (K.ImportSpecifierKind | K.ImportNamespaceSpecifierKind | K.ImportDefaultSpecifierKind)[];
  408. source: K.LiteralKind;
  409. importKind: "value" | "type";
  410. }
  411. export interface TaggedTemplateExpression extends Omit<Expression, "type"> {
  412. type: "TaggedTemplateExpression";
  413. tag: K.ExpressionKind;
  414. quasi: K.TemplateLiteralKind;
  415. }
  416. export interface TemplateLiteral extends Omit<Expression, "type"> {
  417. type: "TemplateLiteral";
  418. quasis: K.TemplateElementKind[];
  419. expressions: K.ExpressionKind[];
  420. }
  421. export interface TemplateElement extends Omit<Node, "type"> {
  422. type: "TemplateElement";
  423. value: {
  424. cooked: string;
  425. raw: string;
  426. };
  427. tail: boolean;
  428. }
  429. export interface SpreadProperty extends Omit<Node, "type"> {
  430. type: "SpreadProperty";
  431. argument: K.ExpressionKind;
  432. }
  433. export interface SpreadPropertyPattern extends Omit<Pattern, "type"> {
  434. type: "SpreadPropertyPattern";
  435. argument: K.PatternKind;
  436. }
  437. export interface AwaitExpression extends Omit<Expression, "type"> {
  438. type: "AwaitExpression";
  439. argument: K.ExpressionKind | null;
  440. all: boolean;
  441. }
  442. export interface JSXAttribute extends Omit<Node, "type"> {
  443. type: "JSXAttribute";
  444. name: K.JSXIdentifierKind | K.JSXNamespacedNameKind;
  445. value: K.LiteralKind | K.JSXExpressionContainerKind | null;
  446. }
  447. export interface JSXIdentifier extends Omit<Identifier, "type" | "name"> {
  448. type: "JSXIdentifier";
  449. name: string;
  450. }
  451. export interface JSXNamespacedName extends Omit<Node, "type"> {
  452. type: "JSXNamespacedName";
  453. namespace: K.JSXIdentifierKind;
  454. name: K.JSXIdentifierKind;
  455. }
  456. export interface JSXExpressionContainer extends Omit<Expression, "type"> {
  457. type: "JSXExpressionContainer";
  458. expression: K.ExpressionKind;
  459. }
  460. export interface JSXMemberExpression extends Omit<MemberExpression, "type" | "object" | "property" | "computed"> {
  461. type: "JSXMemberExpression";
  462. object: K.JSXIdentifierKind | K.JSXMemberExpressionKind;
  463. property: K.JSXIdentifierKind;
  464. computed: boolean;
  465. }
  466. export interface JSXSpreadAttribute extends Omit<Node, "type"> {
  467. type: "JSXSpreadAttribute";
  468. argument: K.ExpressionKind;
  469. }
  470. export interface JSXElement extends Omit<Expression, "type"> {
  471. type: "JSXElement";
  472. openingElement: K.JSXOpeningElementKind;
  473. closingElement: K.JSXClosingElementKind | null;
  474. children: (K.JSXElementKind | K.JSXExpressionContainerKind | K.JSXFragmentKind | K.JSXTextKind | K.LiteralKind)[];
  475. name: K.JSXIdentifierKind | K.JSXNamespacedNameKind | K.JSXMemberExpressionKind;
  476. selfClosing: boolean;
  477. attributes: (K.JSXAttributeKind | K.JSXSpreadAttributeKind)[];
  478. }
  479. export interface JSXOpeningElement extends Omit<Node, "type"> {
  480. type: "JSXOpeningElement";
  481. name: K.JSXIdentifierKind | K.JSXNamespacedNameKind | K.JSXMemberExpressionKind;
  482. attributes: (K.JSXAttributeKind | K.JSXSpreadAttributeKind)[];
  483. selfClosing: boolean;
  484. }
  485. export interface JSXClosingElement extends Omit<Node, "type"> {
  486. type: "JSXClosingElement";
  487. name: K.JSXIdentifierKind | K.JSXNamespacedNameKind | K.JSXMemberExpressionKind;
  488. }
  489. export interface JSXFragment extends Omit<Expression, "type"> {
  490. type: "JSXFragment";
  491. openingElement: K.JSXOpeningFragmentKind;
  492. closingElement: K.JSXClosingFragmentKind;
  493. children: (K.JSXElementKind | K.JSXExpressionContainerKind | K.JSXFragmentKind | K.JSXTextKind | K.LiteralKind)[];
  494. }
  495. export interface JSXText extends Omit<Literal, "type" | "value"> {
  496. type: "JSXText";
  497. value: string;
  498. }
  499. export interface JSXOpeningFragment extends Omit<Node, "type"> {
  500. type: "JSXOpeningFragment";
  501. }
  502. export interface JSXClosingFragment extends Omit<Node, "type"> {
  503. type: "JSXClosingFragment";
  504. }
  505. export interface JSXEmptyExpression extends Omit<Expression, "type"> {
  506. type: "JSXEmptyExpression";
  507. }
  508. export interface JSXSpreadChild extends Omit<Expression, "type"> {
  509. type: "JSXSpreadChild";
  510. expression: K.ExpressionKind;
  511. }
  512. export interface TypeParameterDeclaration extends Omit<Node, "type"> {
  513. type: "TypeParameterDeclaration";
  514. params: K.TypeParameterKind[];
  515. }
  516. export interface TSTypeParameterDeclaration extends Omit<Declaration, "type"> {
  517. type: "TSTypeParameterDeclaration";
  518. params: K.TSTypeParameterKind[];
  519. }
  520. export interface TypeParameterInstantiation extends Omit<Node, "type"> {
  521. type: "TypeParameterInstantiation";
  522. params: K.FlowTypeKind[];
  523. }
  524. export interface TSTypeParameterInstantiation extends Omit<Node, "type"> {
  525. type: "TSTypeParameterInstantiation";
  526. params: K.TSTypeKind[];
  527. }
  528. export interface ClassImplements extends Omit<Node, "type"> {
  529. type: "ClassImplements";
  530. id: K.IdentifierKind;
  531. superClass: K.ExpressionKind | null;
  532. typeParameters: K.TypeParameterInstantiationKind | null;
  533. }
  534. export interface TSType extends Node {
  535. }
  536. export interface TSHasOptionalTypeParameterInstantiation {
  537. typeParameters: K.TSTypeParameterInstantiationKind | null;
  538. }
  539. export interface TSExpressionWithTypeArguments extends Omit<TSType, "type">, TSHasOptionalTypeParameterInstantiation {
  540. type: "TSExpressionWithTypeArguments";
  541. expression: K.IdentifierKind | K.TSQualifiedNameKind;
  542. }
  543. export interface Flow extends Node {
  544. }
  545. export interface FlowType extends Flow {
  546. }
  547. export interface AnyTypeAnnotation extends Omit<FlowType, "type"> {
  548. type: "AnyTypeAnnotation";
  549. }
  550. export interface EmptyTypeAnnotation extends Omit<FlowType, "type"> {
  551. type: "EmptyTypeAnnotation";
  552. }
  553. export interface MixedTypeAnnotation extends Omit<FlowType, "type"> {
  554. type: "MixedTypeAnnotation";
  555. }
  556. export interface VoidTypeAnnotation extends Omit<FlowType, "type"> {
  557. type: "VoidTypeAnnotation";
  558. }
  559. export interface NumberTypeAnnotation extends Omit<FlowType, "type"> {
  560. type: "NumberTypeAnnotation";
  561. }
  562. export interface NumberLiteralTypeAnnotation extends Omit<FlowType, "type"> {
  563. type: "NumberLiteralTypeAnnotation";
  564. value: number;
  565. raw: string;
  566. }
  567. export interface NumericLiteralTypeAnnotation extends Omit<FlowType, "type"> {
  568. type: "NumericLiteralTypeAnnotation";
  569. value: number;
  570. raw: string;
  571. }
  572. export interface StringTypeAnnotation extends Omit<FlowType, "type"> {
  573. type: "StringTypeAnnotation";
  574. }
  575. export interface StringLiteralTypeAnnotation extends Omit<FlowType, "type"> {
  576. type: "StringLiteralTypeAnnotation";
  577. value: string;
  578. raw: string;
  579. }
  580. export interface BooleanTypeAnnotation extends Omit<FlowType, "type"> {
  581. type: "BooleanTypeAnnotation";
  582. }
  583. export interface BooleanLiteralTypeAnnotation extends Omit<FlowType, "type"> {
  584. type: "BooleanLiteralTypeAnnotation";
  585. value: boolean;
  586. raw: string;
  587. }
  588. export interface NullableTypeAnnotation extends Omit<FlowType, "type"> {
  589. type: "NullableTypeAnnotation";
  590. typeAnnotation: K.FlowTypeKind;
  591. }
  592. export interface NullLiteralTypeAnnotation extends Omit<FlowType, "type"> {
  593. type: "NullLiteralTypeAnnotation";
  594. }
  595. export interface NullTypeAnnotation extends Omit<FlowType, "type"> {
  596. type: "NullTypeAnnotation";
  597. }
  598. export interface ThisTypeAnnotation extends Omit<FlowType, "type"> {
  599. type: "ThisTypeAnnotation";
  600. }
  601. export interface ExistsTypeAnnotation extends Omit<FlowType, "type"> {
  602. type: "ExistsTypeAnnotation";
  603. }
  604. export interface ExistentialTypeParam extends Omit<FlowType, "type"> {
  605. type: "ExistentialTypeParam";
  606. }
  607. export interface FunctionTypeAnnotation extends Omit<FlowType, "type"> {
  608. type: "FunctionTypeAnnotation";
  609. params: K.FunctionTypeParamKind[];
  610. returnType: K.FlowTypeKind;
  611. rest: K.FunctionTypeParamKind | null;
  612. typeParameters: K.TypeParameterDeclarationKind | null;
  613. }
  614. export interface FunctionTypeParam extends Omit<Node, "type"> {
  615. type: "FunctionTypeParam";
  616. name: K.IdentifierKind;
  617. typeAnnotation: K.FlowTypeKind;
  618. optional: boolean;
  619. }
  620. export interface ArrayTypeAnnotation extends Omit<FlowType, "type"> {
  621. type: "ArrayTypeAnnotation";
  622. elementType: K.FlowTypeKind;
  623. }
  624. export interface ObjectTypeAnnotation extends Omit<FlowType, "type"> {
  625. type: "ObjectTypeAnnotation";
  626. properties: (K.ObjectTypePropertyKind | K.ObjectTypeSpreadPropertyKind)[];
  627. indexers: K.ObjectTypeIndexerKind[];
  628. callProperties: K.ObjectTypeCallPropertyKind[];
  629. inexact: boolean | undefined;
  630. exact: boolean;
  631. internalSlots: K.ObjectTypeInternalSlotKind[];
  632. }
  633. export interface ObjectTypeProperty extends Omit<Node, "type"> {
  634. type: "ObjectTypeProperty";
  635. key: K.LiteralKind | K.IdentifierKind;
  636. value: K.FlowTypeKind;
  637. optional: boolean;
  638. variance: K.VarianceKind | "plus" | "minus" | null;
  639. }
  640. export interface ObjectTypeSpreadProperty extends Omit<Node, "type"> {
  641. type: "ObjectTypeSpreadProperty";
  642. argument: K.FlowTypeKind;
  643. }
  644. export interface ObjectTypeIndexer extends Omit<Node, "type"> {
  645. type: "ObjectTypeIndexer";
  646. id: K.IdentifierKind;
  647. key: K.FlowTypeKind;
  648. value: K.FlowTypeKind;
  649. variance: K.VarianceKind | "plus" | "minus" | null;
  650. }
  651. export interface ObjectTypeCallProperty extends Omit<Node, "type"> {
  652. type: "ObjectTypeCallProperty";
  653. value: K.FunctionTypeAnnotationKind;
  654. static: boolean;
  655. }
  656. export interface ObjectTypeInternalSlot extends Omit<Node, "type"> {
  657. type: "ObjectTypeInternalSlot";
  658. id: K.IdentifierKind;
  659. value: K.FlowTypeKind;
  660. optional: boolean;
  661. static: boolean;
  662. method: boolean;
  663. }
  664. export interface Variance extends Omit<Node, "type"> {
  665. type: "Variance";
  666. kind: "plus" | "minus";
  667. }
  668. export interface QualifiedTypeIdentifier extends Omit<Node, "type"> {
  669. type: "QualifiedTypeIdentifier";
  670. qualification: K.IdentifierKind | K.QualifiedTypeIdentifierKind;
  671. id: K.IdentifierKind;
  672. }
  673. export interface GenericTypeAnnotation extends Omit<FlowType, "type"> {
  674. type: "GenericTypeAnnotation";
  675. id: K.IdentifierKind | K.QualifiedTypeIdentifierKind;
  676. typeParameters: K.TypeParameterInstantiationKind | null;
  677. }
  678. export interface MemberTypeAnnotation extends Omit<FlowType, "type"> {
  679. type: "MemberTypeAnnotation";
  680. object: K.IdentifierKind;
  681. property: K.MemberTypeAnnotationKind | K.GenericTypeAnnotationKind;
  682. }
  683. export interface UnionTypeAnnotation extends Omit<FlowType, "type"> {
  684. type: "UnionTypeAnnotation";
  685. types: K.FlowTypeKind[];
  686. }
  687. export interface IntersectionTypeAnnotation extends Omit<FlowType, "type"> {
  688. type: "IntersectionTypeAnnotation";
  689. types: K.FlowTypeKind[];
  690. }
  691. export interface TypeofTypeAnnotation extends Omit<FlowType, "type"> {
  692. type: "TypeofTypeAnnotation";
  693. argument: K.FlowTypeKind;
  694. }
  695. export interface TypeParameter extends Omit<FlowType, "type"> {
  696. type: "TypeParameter";
  697. name: string;
  698. variance: K.VarianceKind | "plus" | "minus" | null;
  699. bound: K.TypeAnnotationKind | null;
  700. }
  701. export interface InterfaceTypeAnnotation extends Omit<FlowType, "type"> {
  702. type: "InterfaceTypeAnnotation";
  703. body: K.ObjectTypeAnnotationKind;
  704. extends: K.InterfaceExtendsKind[] | null;
  705. }
  706. export interface InterfaceExtends extends Omit<Node, "type"> {
  707. type: "InterfaceExtends";
  708. id: K.IdentifierKind;
  709. typeParameters: K.TypeParameterInstantiationKind | null;
  710. }
  711. export interface InterfaceDeclaration extends Omit<Declaration, "type"> {
  712. type: "InterfaceDeclaration";
  713. id: K.IdentifierKind;
  714. typeParameters: K.TypeParameterDeclarationKind | null;
  715. body: K.ObjectTypeAnnotationKind;
  716. extends: K.InterfaceExtendsKind[];
  717. }
  718. export interface DeclareInterface extends Omit<InterfaceDeclaration, "type"> {
  719. type: "DeclareInterface";
  720. }
  721. export interface TypeAlias extends Omit<Declaration, "type"> {
  722. type: "TypeAlias";
  723. id: K.IdentifierKind;
  724. typeParameters: K.TypeParameterDeclarationKind | null;
  725. right: K.FlowTypeKind;
  726. }
  727. export interface OpaqueType extends Omit<Declaration, "type"> {
  728. type: "OpaqueType";
  729. id: K.IdentifierKind;
  730. typeParameters: K.TypeParameterDeclarationKind | null;
  731. impltype: K.FlowTypeKind;
  732. supertype: K.FlowTypeKind;
  733. }
  734. export interface DeclareTypeAlias extends Omit<TypeAlias, "type"> {
  735. type: "DeclareTypeAlias";
  736. }
  737. export interface DeclareOpaqueType extends Omit<TypeAlias, "type"> {
  738. type: "DeclareOpaqueType";
  739. }
  740. export interface TypeCastExpression extends Omit<Expression, "type"> {
  741. type: "TypeCastExpression";
  742. expression: K.ExpressionKind;
  743. typeAnnotation: K.TypeAnnotationKind;
  744. }
  745. export interface TupleTypeAnnotation extends Omit<FlowType, "type"> {
  746. type: "TupleTypeAnnotation";
  747. types: K.FlowTypeKind[];
  748. }
  749. export interface DeclareVariable extends Omit<Statement, "type"> {
  750. type: "DeclareVariable";
  751. id: K.IdentifierKind;
  752. }
  753. export interface DeclareFunction extends Omit<Statement, "type"> {
  754. type: "DeclareFunction";
  755. id: K.IdentifierKind;
  756. }
  757. export interface DeclareClass extends Omit<InterfaceDeclaration, "type"> {
  758. type: "DeclareClass";
  759. }
  760. export interface DeclareModule extends Omit<Statement, "type"> {
  761. type: "DeclareModule";
  762. id: K.IdentifierKind | K.LiteralKind;
  763. body: K.BlockStatementKind;
  764. }
  765. export interface DeclareModuleExports extends Omit<Statement, "type"> {
  766. type: "DeclareModuleExports";
  767. typeAnnotation: K.TypeAnnotationKind;
  768. }
  769. export interface DeclareExportDeclaration extends Omit<Declaration, "type"> {
  770. type: "DeclareExportDeclaration";
  771. default: boolean;
  772. declaration: K.DeclareVariableKind | K.DeclareFunctionKind | K.DeclareClassKind | K.FlowTypeKind | null;
  773. specifiers: (K.ExportSpecifierKind | K.ExportBatchSpecifierKind)[];
  774. source: K.LiteralKind | null;
  775. }
  776. export interface ExportSpecifier extends Omit<ModuleSpecifier, "type"> {
  777. type: "ExportSpecifier";
  778. exported: K.IdentifierKind;
  779. }
  780. export interface ExportBatchSpecifier extends Omit<Specifier, "type"> {
  781. type: "ExportBatchSpecifier";
  782. }
  783. export interface DeclareExportAllDeclaration extends Omit<Declaration, "type"> {
  784. type: "DeclareExportAllDeclaration";
  785. source: K.LiteralKind | null;
  786. }
  787. export interface FlowPredicate extends Flow {
  788. }
  789. export interface InferredPredicate extends Omit<FlowPredicate, "type"> {
  790. type: "InferredPredicate";
  791. }
  792. export interface DeclaredPredicate extends Omit<FlowPredicate, "type"> {
  793. type: "DeclaredPredicate";
  794. value: K.ExpressionKind;
  795. }
  796. export interface ExportDeclaration extends Omit<Declaration, "type"> {
  797. type: "ExportDeclaration";
  798. default: boolean;
  799. declaration: K.DeclarationKind | K.ExpressionKind | null;
  800. specifiers: (K.ExportSpecifierKind | K.ExportBatchSpecifierKind)[];
  801. source: K.LiteralKind | null;
  802. }
  803. export interface Block extends Comment {
  804. type: "Block";
  805. }
  806. export interface Line extends Comment {
  807. type: "Line";
  808. }
  809. export interface Noop extends Omit<Statement, "type"> {
  810. type: "Noop";
  811. }
  812. export interface DoExpression extends Omit<Expression, "type"> {
  813. type: "DoExpression";
  814. body: K.StatementKind[];
  815. }
  816. export interface Super extends Omit<Expression, "type"> {
  817. type: "Super";
  818. }
  819. export interface BindExpression extends Omit<Expression, "type"> {
  820. type: "BindExpression";
  821. object: K.ExpressionKind | null;
  822. callee: K.ExpressionKind;
  823. }
  824. export interface Decorator extends Omit<Node, "type"> {
  825. type: "Decorator";
  826. expression: K.ExpressionKind;
  827. }
  828. export interface MetaProperty extends Omit<Expression, "type"> {
  829. type: "MetaProperty";
  830. meta: K.IdentifierKind;
  831. property: K.IdentifierKind;
  832. }
  833. export interface ParenthesizedExpression extends Omit<Expression, "type"> {
  834. type: "ParenthesizedExpression";
  835. expression: K.ExpressionKind;
  836. }
  837. export interface ExportDefaultDeclaration extends Omit<Declaration, "type"> {
  838. type: "ExportDefaultDeclaration";
  839. declaration: K.DeclarationKind | K.ExpressionKind;
  840. }
  841. export interface ExportNamedDeclaration extends Omit<Declaration, "type"> {
  842. type: "ExportNamedDeclaration";
  843. declaration: K.DeclarationKind | null;
  844. specifiers: K.ExportSpecifierKind[];
  845. source: K.LiteralKind | null;
  846. }
  847. export interface ExportNamespaceSpecifier extends Omit<Specifier, "type"> {
  848. type: "ExportNamespaceSpecifier";
  849. exported: K.IdentifierKind;
  850. }
  851. export interface ExportDefaultSpecifier extends Omit<Specifier, "type"> {
  852. type: "ExportDefaultSpecifier";
  853. exported: K.IdentifierKind;
  854. }
  855. export interface ExportAllDeclaration extends Omit<Declaration, "type"> {
  856. type: "ExportAllDeclaration";
  857. exported: K.IdentifierKind | null;
  858. source: K.LiteralKind;
  859. }
  860. export interface CommentBlock extends Comment {
  861. type: "CommentBlock";
  862. }
  863. export interface CommentLine extends Comment {
  864. type: "CommentLine";
  865. }
  866. export interface Directive extends Omit<Node, "type"> {
  867. type: "Directive";
  868. value: K.DirectiveLiteralKind;
  869. }
  870. export interface DirectiveLiteral extends Omit<Node, "type">, Omit<Expression, "type"> {
  871. type: "DirectiveLiteral";
  872. value: string;
  873. }
  874. export interface InterpreterDirective extends Omit<Node, "type"> {
  875. type: "InterpreterDirective";
  876. value: string;
  877. }
  878. export interface StringLiteral extends Omit<Literal, "type" | "value"> {
  879. type: "StringLiteral";
  880. value: string;
  881. }
  882. export interface NumericLiteral extends Omit<Literal, "type" | "value"> {
  883. type: "NumericLiteral";
  884. value: number;
  885. raw: string | null;
  886. extra: {
  887. rawValue: number;
  888. raw: string;
  889. };
  890. }
  891. export interface BigIntLiteral extends Omit<Literal, "type" | "value"> {
  892. type: "BigIntLiteral";
  893. value: string | number;
  894. extra: {
  895. rawValue: string;
  896. raw: string;
  897. };
  898. }
  899. export interface NullLiteral extends Omit<Literal, "type" | "value"> {
  900. type: "NullLiteral";
  901. value: null;
  902. }
  903. export interface BooleanLiteral extends Omit<Literal, "type" | "value"> {
  904. type: "BooleanLiteral";
  905. value: boolean;
  906. }
  907. export interface RegExpLiteral extends Omit<Literal, "type" | "value"> {
  908. type: "RegExpLiteral";
  909. pattern: string;
  910. flags: string;
  911. value: RegExp;
  912. }
  913. export interface ObjectMethod extends Omit<Node, "type">, Omit<Function, "type" | "params" | "body" | "generator" | "async"> {
  914. type: "ObjectMethod";
  915. kind: "method" | "get" | "set";
  916. key: K.LiteralKind | K.IdentifierKind | K.ExpressionKind;
  917. params: K.PatternKind[];
  918. body: K.BlockStatementKind;
  919. computed: boolean;
  920. generator: boolean;
  921. async: boolean;
  922. accessibility: K.LiteralKind | null;
  923. decorators: K.DecoratorKind[] | null;
  924. }
  925. export interface ClassPrivateProperty extends Omit<ClassProperty, "type" | "key" | "value"> {
  926. type: "ClassPrivateProperty";
  927. key: K.PrivateNameKind;
  928. value: K.ExpressionKind | null;
  929. }
  930. export interface ClassMethod extends Omit<Declaration, "type">, Omit<Function, "type" | "body"> {
  931. type: "ClassMethod";
  932. key: K.LiteralKind | K.IdentifierKind | K.ExpressionKind;
  933. kind: "get" | "set" | "method" | "constructor";
  934. body: K.BlockStatementKind;
  935. computed: boolean;
  936. static: boolean | null;
  937. abstract: boolean | null;
  938. access: "public" | "private" | "protected" | null;
  939. accessibility: "public" | "private" | "protected" | null;
  940. decorators: K.DecoratorKind[] | null;
  941. optional: boolean | null;
  942. }
  943. export interface ClassPrivateMethod extends Omit<Declaration, "type">, Omit<Function, "type" | "body"> {
  944. type: "ClassPrivateMethod";
  945. key: K.PrivateNameKind;
  946. kind: "get" | "set" | "method" | "constructor";
  947. body: K.BlockStatementKind;
  948. computed: boolean;
  949. static: boolean | null;
  950. abstract: boolean | null;
  951. access: "public" | "private" | "protected" | null;
  952. accessibility: "public" | "private" | "protected" | null;
  953. decorators: K.DecoratorKind[] | null;
  954. optional: boolean | null;
  955. }
  956. export interface PrivateName extends Omit<Expression, "type">, Omit<Pattern, "type"> {
  957. type: "PrivateName";
  958. id: K.IdentifierKind;
  959. }
  960. export interface RestProperty extends Omit<Node, "type"> {
  961. type: "RestProperty";
  962. argument: K.ExpressionKind;
  963. }
  964. export interface ForAwaitStatement extends Omit<Statement, "type"> {
  965. type: "ForAwaitStatement";
  966. left: K.VariableDeclarationKind | K.ExpressionKind;
  967. right: K.ExpressionKind;
  968. body: K.StatementKind;
  969. }
  970. export interface Import extends Omit<Expression, "type"> {
  971. type: "Import";
  972. }
  973. export interface TSQualifiedName extends Omit<Node, "type"> {
  974. type: "TSQualifiedName";
  975. left: K.IdentifierKind | K.TSQualifiedNameKind;
  976. right: K.IdentifierKind | K.TSQualifiedNameKind;
  977. }
  978. export interface TSTypeReference extends Omit<TSType, "type">, TSHasOptionalTypeParameterInstantiation {
  979. type: "TSTypeReference";
  980. typeName: K.IdentifierKind | K.TSQualifiedNameKind;
  981. }
  982. export interface TSHasOptionalTypeParameters {
  983. typeParameters: K.TSTypeParameterDeclarationKind | null | undefined;
  984. }
  985. export interface TSHasOptionalTypeAnnotation {
  986. typeAnnotation: K.TSTypeAnnotationKind | null;
  987. }
  988. export interface TSAsExpression extends Omit<Expression, "type">, Omit<Pattern, "type"> {
  989. type: "TSAsExpression";
  990. expression: K.ExpressionKind;
  991. typeAnnotation: K.TSTypeKind;
  992. extra: {
  993. parenthesized: boolean;
  994. } | null;
  995. }
  996. export interface TSNonNullExpression extends Omit<Expression, "type">, Omit<Pattern, "type"> {
  997. type: "TSNonNullExpression";
  998. expression: K.ExpressionKind;
  999. }
  1000. export interface TSAnyKeyword extends Omit<TSType, "type"> {
  1001. type: "TSAnyKeyword";
  1002. }
  1003. export interface TSBigIntKeyword extends Omit<TSType, "type"> {
  1004. type: "TSBigIntKeyword";
  1005. }
  1006. export interface TSBooleanKeyword extends Omit<TSType, "type"> {
  1007. type: "TSBooleanKeyword";
  1008. }
  1009. export interface TSNeverKeyword extends Omit<TSType, "type"> {
  1010. type: "TSNeverKeyword";
  1011. }
  1012. export interface TSNullKeyword extends Omit<TSType, "type"> {
  1013. type: "TSNullKeyword";
  1014. }
  1015. export interface TSNumberKeyword extends Omit<TSType, "type"> {
  1016. type: "TSNumberKeyword";
  1017. }
  1018. export interface TSObjectKeyword extends Omit<TSType, "type"> {
  1019. type: "TSObjectKeyword";
  1020. }
  1021. export interface TSStringKeyword extends Omit<TSType, "type"> {
  1022. type: "TSStringKeyword";
  1023. }
  1024. export interface TSSymbolKeyword extends Omit<TSType, "type"> {
  1025. type: "TSSymbolKeyword";
  1026. }
  1027. export interface TSUndefinedKeyword extends Omit<TSType, "type"> {
  1028. type: "TSUndefinedKeyword";
  1029. }
  1030. export interface TSUnknownKeyword extends Omit<TSType, "type"> {
  1031. type: "TSUnknownKeyword";
  1032. }
  1033. export interface TSVoidKeyword extends Omit<TSType, "type"> {
  1034. type: "TSVoidKeyword";
  1035. }
  1036. export interface TSThisType extends Omit<TSType, "type"> {
  1037. type: "TSThisType";
  1038. }
  1039. export interface TSArrayType extends Omit<TSType, "type"> {
  1040. type: "TSArrayType";
  1041. elementType: K.TSTypeKind;
  1042. }
  1043. export interface TSLiteralType extends Omit<TSType, "type"> {
  1044. type: "TSLiteralType";
  1045. literal: K.NumericLiteralKind | K.StringLiteralKind | K.BooleanLiteralKind | K.TemplateLiteralKind | K.UnaryExpressionKind;
  1046. }
  1047. export interface TSUnionType extends Omit<TSType, "type"> {
  1048. type: "TSUnionType";
  1049. types: K.TSTypeKind[];
  1050. }
  1051. export interface TSIntersectionType extends Omit<TSType, "type"> {
  1052. type: "TSIntersectionType";
  1053. types: K.TSTypeKind[];
  1054. }
  1055. export interface TSConditionalType extends Omit<TSType, "type"> {
  1056. type: "TSConditionalType";
  1057. checkType: K.TSTypeKind;
  1058. extendsType: K.TSTypeKind;
  1059. trueType: K.TSTypeKind;
  1060. falseType: K.TSTypeKind;
  1061. }
  1062. export interface TSInferType extends Omit<TSType, "type"> {
  1063. type: "TSInferType";
  1064. typeParameter: K.TSTypeParameterKind;
  1065. }
  1066. export interface TSTypeParameter extends Omit<Identifier, "type" | "name"> {
  1067. type: "TSTypeParameter";
  1068. name: string;
  1069. constraint: K.TSTypeKind | undefined;
  1070. default: K.TSTypeKind | undefined;
  1071. }
  1072. export interface TSParenthesizedType extends Omit<TSType, "type"> {
  1073. type: "TSParenthesizedType";
  1074. typeAnnotation: K.TSTypeKind;
  1075. }
  1076. export interface TSFunctionType extends Omit<TSType, "type">, TSHasOptionalTypeParameters, TSHasOptionalTypeAnnotation {
  1077. type: "TSFunctionType";
  1078. parameters: (K.IdentifierKind | K.RestElementKind | K.ArrayPatternKind | K.ObjectPatternKind)[];
  1079. }
  1080. export interface TSConstructorType extends Omit<TSType, "type">, TSHasOptionalTypeParameters, TSHasOptionalTypeAnnotation {
  1081. type: "TSConstructorType";
  1082. parameters: (K.IdentifierKind | K.RestElementKind | K.ArrayPatternKind | K.ObjectPatternKind)[];
  1083. }
  1084. export interface TSDeclareFunction extends Omit<Declaration, "type">, TSHasOptionalTypeParameters {
  1085. type: "TSDeclareFunction";
  1086. declare: boolean;
  1087. async: boolean;
  1088. generator: boolean;
  1089. id: K.IdentifierKind | null;
  1090. params: K.PatternKind[];
  1091. returnType: K.TSTypeAnnotationKind | K.NoopKind | null;
  1092. }
  1093. export interface TSDeclareMethod extends Omit<Declaration, "type">, TSHasOptionalTypeParameters {
  1094. type: "TSDeclareMethod";
  1095. async: boolean;
  1096. generator: boolean;
  1097. params: K.PatternKind[];
  1098. abstract: boolean;
  1099. accessibility: "public" | "private" | "protected" | undefined;
  1100. static: boolean;
  1101. computed: boolean;
  1102. optional: boolean;
  1103. key: K.IdentifierKind | K.StringLiteralKind | K.NumericLiteralKind | K.ExpressionKind;
  1104. kind: "get" | "set" | "method" | "constructor";
  1105. access: "public" | "private" | "protected" | undefined;
  1106. decorators: K.DecoratorKind[] | null;
  1107. returnType: K.TSTypeAnnotationKind | K.NoopKind | null;
  1108. }
  1109. export interface TSMappedType extends Omit<TSType, "type"> {
  1110. type: "TSMappedType";
  1111. readonly: boolean | "+" | "-";
  1112. typeParameter: K.TSTypeParameterKind;
  1113. optional: boolean | "+" | "-";
  1114. typeAnnotation: K.TSTypeKind | null;
  1115. }
  1116. export interface TSTupleType extends Omit<TSType, "type"> {
  1117. type: "TSTupleType";
  1118. elementTypes: K.TSTypeKind[];
  1119. }
  1120. export interface TSRestType extends Omit<TSType, "type"> {
  1121. type: "TSRestType";
  1122. typeAnnotation: K.TSTypeKind;
  1123. }
  1124. export interface TSOptionalType extends Omit<TSType, "type"> {
  1125. type: "TSOptionalType";
  1126. typeAnnotation: K.TSTypeKind;
  1127. }
  1128. export interface TSIndexedAccessType extends Omit<TSType, "type"> {
  1129. type: "TSIndexedAccessType";
  1130. objectType: K.TSTypeKind;
  1131. indexType: K.TSTypeKind;
  1132. }
  1133. export interface TSTypeOperator extends Omit<TSType, "type"> {
  1134. type: "TSTypeOperator";
  1135. operator: string;
  1136. typeAnnotation: K.TSTypeKind;
  1137. }
  1138. export interface TSIndexSignature extends Omit<Declaration, "type">, TSHasOptionalTypeAnnotation {
  1139. type: "TSIndexSignature";
  1140. parameters: K.IdentifierKind[];
  1141. readonly: boolean;
  1142. }
  1143. export interface TSPropertySignature extends Omit<Declaration, "type">, TSHasOptionalTypeAnnotation {
  1144. type: "TSPropertySignature";
  1145. key: K.ExpressionKind;
  1146. computed: boolean;
  1147. readonly: boolean;
  1148. optional: boolean;
  1149. initializer: K.ExpressionKind | null;
  1150. }
  1151. export interface TSMethodSignature extends Omit<Declaration, "type">, TSHasOptionalTypeParameters, TSHasOptionalTypeAnnotation {
  1152. type: "TSMethodSignature";
  1153. key: K.ExpressionKind;
  1154. computed: boolean;
  1155. optional: boolean;
  1156. parameters: (K.IdentifierKind | K.RestElementKind | K.ArrayPatternKind | K.ObjectPatternKind)[];
  1157. }
  1158. export interface TSTypePredicate extends Omit<TSTypeAnnotation, "type" | "typeAnnotation"> {
  1159. type: "TSTypePredicate";
  1160. parameterName: K.IdentifierKind | K.TSThisTypeKind;
  1161. typeAnnotation: K.TSTypeAnnotationKind;
  1162. }
  1163. export interface TSCallSignatureDeclaration extends Omit<Declaration, "type">, TSHasOptionalTypeParameters, TSHasOptionalTypeAnnotation {
  1164. type: "TSCallSignatureDeclaration";
  1165. parameters: (K.IdentifierKind | K.RestElementKind | K.ArrayPatternKind | K.ObjectPatternKind)[];
  1166. }
  1167. export interface TSConstructSignatureDeclaration extends Omit<Declaration, "type">, TSHasOptionalTypeParameters, TSHasOptionalTypeAnnotation {
  1168. type: "TSConstructSignatureDeclaration";
  1169. parameters: (K.IdentifierKind | K.RestElementKind | K.ArrayPatternKind | K.ObjectPatternKind)[];
  1170. }
  1171. export interface TSEnumMember extends Omit<Node, "type"> {
  1172. type: "TSEnumMember";
  1173. id: K.IdentifierKind | K.StringLiteralKind;
  1174. initializer: K.ExpressionKind | null;
  1175. }
  1176. export interface TSTypeQuery extends Omit<TSType, "type"> {
  1177. type: "TSTypeQuery";
  1178. exprName: K.IdentifierKind | K.TSQualifiedNameKind | K.TSImportTypeKind;
  1179. }
  1180. export interface TSImportType extends Omit<TSType, "type">, TSHasOptionalTypeParameterInstantiation {
  1181. type: "TSImportType";
  1182. argument: K.StringLiteralKind;
  1183. qualifier: K.IdentifierKind | K.TSQualifiedNameKind | undefined;
  1184. }
  1185. export interface TSTypeLiteral extends Omit<TSType, "type"> {
  1186. type: "TSTypeLiteral";
  1187. members: (K.TSCallSignatureDeclarationKind | K.TSConstructSignatureDeclarationKind | K.TSIndexSignatureKind | K.TSMethodSignatureKind | K.TSPropertySignatureKind)[];
  1188. }
  1189. export interface TSTypeAssertion extends Omit<Expression, "type">, Omit<Pattern, "type"> {
  1190. type: "TSTypeAssertion";
  1191. typeAnnotation: K.TSTypeKind;
  1192. expression: K.ExpressionKind;
  1193. extra: {
  1194. parenthesized: boolean;
  1195. } | null;
  1196. }
  1197. export interface TSEnumDeclaration extends Omit<Declaration, "type"> {
  1198. type: "TSEnumDeclaration";
  1199. id: K.IdentifierKind;
  1200. const: boolean;
  1201. declare: boolean;
  1202. members: K.TSEnumMemberKind[];
  1203. initializer: K.ExpressionKind | null;
  1204. }
  1205. export interface TSTypeAliasDeclaration extends Omit<Declaration, "type">, TSHasOptionalTypeParameters {
  1206. type: "TSTypeAliasDeclaration";
  1207. id: K.IdentifierKind;
  1208. declare: boolean;
  1209. typeAnnotation: K.TSTypeKind;
  1210. }
  1211. export interface TSModuleBlock extends Omit<Node, "type"> {
  1212. type: "TSModuleBlock";
  1213. body: K.StatementKind[];
  1214. }
  1215. export interface TSModuleDeclaration extends Omit<Declaration, "type"> {
  1216. type: "TSModuleDeclaration";
  1217. id: K.StringLiteralKind | K.IdentifierKind | K.TSQualifiedNameKind;
  1218. declare: boolean;
  1219. global: boolean;
  1220. body: K.TSModuleBlockKind | K.TSModuleDeclarationKind | null;
  1221. }
  1222. export interface TSImportEqualsDeclaration extends Omit<Declaration, "type"> {
  1223. type: "TSImportEqualsDeclaration";
  1224. id: K.IdentifierKind;
  1225. isExport: boolean;
  1226. moduleReference: K.IdentifierKind | K.TSQualifiedNameKind | K.TSExternalModuleReferenceKind;
  1227. }
  1228. export interface TSExternalModuleReference extends Omit<Declaration, "type"> {
  1229. type: "TSExternalModuleReference";
  1230. expression: K.StringLiteralKind;
  1231. }
  1232. export interface TSExportAssignment extends Omit<Statement, "type"> {
  1233. type: "TSExportAssignment";
  1234. expression: K.ExpressionKind;
  1235. }
  1236. export interface TSNamespaceExportDeclaration extends Omit<Declaration, "type"> {
  1237. type: "TSNamespaceExportDeclaration";
  1238. id: K.IdentifierKind;
  1239. }
  1240. export interface TSInterfaceBody extends Omit<Node, "type"> {
  1241. type: "TSInterfaceBody";
  1242. body: (K.TSCallSignatureDeclarationKind | K.TSConstructSignatureDeclarationKind | K.TSIndexSignatureKind | K.TSMethodSignatureKind | K.TSPropertySignatureKind)[];
  1243. }
  1244. export interface TSInterfaceDeclaration extends Omit<Declaration, "type">, TSHasOptionalTypeParameters {
  1245. type: "TSInterfaceDeclaration";
  1246. id: K.IdentifierKind | K.TSQualifiedNameKind;
  1247. declare: boolean;
  1248. extends: K.TSExpressionWithTypeArgumentsKind[] | null;
  1249. body: K.TSInterfaceBodyKind;
  1250. }
  1251. export interface TSParameterProperty extends Omit<Pattern, "type"> {
  1252. type: "TSParameterProperty";
  1253. accessibility: "public" | "private" | "protected" | undefined;
  1254. readonly: boolean;
  1255. parameter: K.IdentifierKind | K.AssignmentPatternKind;
  1256. }
  1257. export interface OptionalMemberExpression extends Omit<MemberExpression, "type"> {
  1258. type: "OptionalMemberExpression";
  1259. optional: boolean;
  1260. }
  1261. export interface OptionalCallExpression extends Omit<CallExpression, "type"> {
  1262. type: "OptionalCallExpression";
  1263. optional: boolean;
  1264. }
  1265. export declare type ASTNode = File | Program | Identifier | BlockStatement | EmptyStatement | ExpressionStatement | IfStatement | LabeledStatement | BreakStatement | ContinueStatement | WithStatement | SwitchStatement | SwitchCase | ReturnStatement | ThrowStatement | TryStatement | CatchClause | WhileStatement | DoWhileStatement | ForStatement | VariableDeclaration | ForInStatement | DebuggerStatement | FunctionDeclaration | FunctionExpression | VariableDeclarator | ThisExpression | ArrayExpression | ObjectExpression | Property | Literal | SequenceExpression | UnaryExpression | BinaryExpression | AssignmentExpression | MemberExpression | UpdateExpression | LogicalExpression | ConditionalExpression | NewExpression | CallExpression | RestElement | TypeAnnotation | TSTypeAnnotation | SpreadElementPattern | ArrowFunctionExpression | ForOfStatement | YieldExpression | GeneratorExpression | ComprehensionBlock | ComprehensionExpression | ObjectProperty | PropertyPattern | ObjectPattern | ArrayPattern | MethodDefinition | SpreadElement | AssignmentPattern | ClassPropertyDefinition | ClassProperty | ClassBody | ClassDeclaration | ClassExpression | ImportSpecifier | ImportNamespaceSpecifier | ImportDefaultSpecifier | ImportDeclaration | TaggedTemplateExpression | TemplateLiteral | TemplateElement | SpreadProperty | SpreadPropertyPattern | AwaitExpression | JSXAttribute | JSXIdentifier | JSXNamespacedName | JSXExpressionContainer | JSXMemberExpression | JSXSpreadAttribute | JSXElement | JSXOpeningElement | JSXClosingElement | JSXFragment | JSXText | JSXOpeningFragment | JSXClosingFragment | JSXEmptyExpression | JSXSpreadChild | TypeParameterDeclaration | TSTypeParameterDeclaration | TypeParameterInstantiation | TSTypeParameterInstantiation | ClassImplements | TSExpressionWithTypeArguments | AnyTypeAnnotation | EmptyTypeAnnotation | MixedTypeAnnotation | VoidTypeAnnotation | NumberTypeAnnotation | NumberLiteralTypeAnnotation | NumericLiteralTypeAnnotation | StringTypeAnnotation | StringLiteralTypeAnnotation | BooleanTypeAnnotation | BooleanLiteralTypeAnnotation | NullableTypeAnnotation | NullLiteralTypeAnnotation | NullTypeAnnotation | ThisTypeAnnotation | ExistsTypeAnnotation | ExistentialTypeParam | FunctionTypeAnnotation | FunctionTypeParam | ArrayTypeAnnotation | ObjectTypeAnnotation | ObjectTypeProperty | ObjectTypeSpreadProperty | ObjectTypeIndexer | ObjectTypeCallProperty | ObjectTypeInternalSlot | Variance | QualifiedTypeIdentifier | GenericTypeAnnotation | MemberTypeAnnotation | UnionTypeAnnotation | IntersectionTypeAnnotation | TypeofTypeAnnotation | TypeParameter | InterfaceTypeAnnotation | InterfaceExtends | InterfaceDeclaration | DeclareInterface | TypeAlias | OpaqueType | DeclareTypeAlias | DeclareOpaqueType | TypeCastExpression | TupleTypeAnnotation | DeclareVariable | DeclareFunction | DeclareClass | DeclareModule | DeclareModuleExports | DeclareExportDeclaration | ExportSpecifier | ExportBatchSpecifier | DeclareExportAllDeclaration | InferredPredicate | DeclaredPredicate | ExportDeclaration | Block | Line | Noop | DoExpression | Super | BindExpression | Decorator | MetaProperty | ParenthesizedExpression | ExportDefaultDeclaration | ExportNamedDeclaration | ExportNamespaceSpecifier | ExportDefaultSpecifier | ExportAllDeclaration | CommentBlock | CommentLine | Directive | DirectiveLiteral | InterpreterDirective | StringLiteral | NumericLiteral | BigIntLiteral | NullLiteral | BooleanLiteral | RegExpLiteral | ObjectMethod | ClassPrivateProperty | ClassMethod | ClassPrivateMethod | PrivateName | RestProperty | ForAwaitStatement | Import | TSQualifiedName | TSTypeReference | TSAsExpression | TSNonNullExpression | TSAnyKeyword | TSBigIntKeyword | TSBooleanKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSThisType | TSArrayType | TSLiteralType | TSUnionType | TSIntersectionType | TSConditionalType | TSInferType | TSTypeParameter | TSParenthesizedType | TSFunctionType | TSConstructorType | TSDeclareFunction | TSDeclareMethod | TSMappedType | TSTupleType | TSRestType | TSOptionalType | TSIndexedAccessType | TSTypeOperator | TSIndexSignature | TSPropertySignature | TSMethodSignature | TSTypePredicate | TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSEnumMember | TSTypeQuery | TSImportType | TSTypeLiteral | TSTypeAssertion | TSEnumDeclaration | TSTypeAliasDeclaration | TSModuleBlock | TSModuleDeclaration | TSImportEqualsDeclaration | TSExternalModuleReference | TSExportAssignment | TSNamespaceExportDeclaration | TSInterfaceBody | TSInterfaceDeclaration | TSParameterProperty | OptionalMemberExpression | OptionalCallExpression;