File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -572,7 +572,24 @@ export type ModuleDeclaration =
572
572
| ExportDefaultDeclaration
573
573
| ExportAllDeclaration
574
574
575
- export type AnyNode = Statement | Expression | Declaration | ModuleDeclaration | Literal | Program | SwitchCase | CatchClause | Property | Super | SpreadElement | TemplateElement | AssignmentProperty | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | ClassBody | MethodDefinition | MetaProperty | ImportAttribute | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier | AnonymousFunctionDeclaration | AnonymousClassDeclaration | PropertyDefinition | PrivateIdentifier | StaticBlock | VariableDeclarator
575
+ /**
576
+ * This interface is only used for defining {@link AnyNode}.
577
+ * It exists so that it can be extended by plugins:
578
+ *
579
+ * @example
580
+ * ```typescript
581
+ * declare module 'acorn' {
582
+ * interface NodeTypes {
583
+ * pluginName: FirstNode | SecondNode | ThirdNode | ... | LastNode;
584
+ * }
585
+ * }
586
+ * ```
587
+ */
588
+ interface NodeTypes {
589
+ core : Statement | Expression | Declaration | ModuleDeclaration | Literal | Program | SwitchCase | CatchClause | Property | Super | SpreadElement | TemplateElement | AssignmentProperty | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | ClassBody | MethodDefinition | MetaProperty | ImportAttribute | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier | AnonymousFunctionDeclaration | AnonymousClassDeclaration | PropertyDefinition | PrivateIdentifier | StaticBlock | VariableDeclarator
590
+ }
591
+
592
+ export type AnyNode = NodeTypes [ keyof NodeTypes ]
576
593
577
594
export function parse ( input : string , options : Options ) : Program
578
595
You can’t perform that action at this time.
0 commit comments