@typescript-eslint/typescript-estree
Version:
A parser that converts TypeScript source code into an ESTree compatible form
179 lines • 13.1 kB
TypeScript
import type { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/types';
import type * as ts from 'typescript';
import type { TSNode } from './ts-nodes';
export interface EstreeToTsNodeTypes {
[ ]: ts.PropertyDeclaration;
[ ]: ts.ArrayLiteralExpression;
[ ]: ts.ArrayBindingPattern | ts.ArrayLiteralExpression;
[ ]: ts.ArrowFunction;
[ ]: ts.BinaryExpression;
[ ]: ts.BinaryExpression | ts.BindingElement | ts.ParameterDeclaration | ts.ShorthandPropertyAssignment;
[ ]: ts.AwaitExpression;
[ ]: ts.BinaryExpression;
[ ]: ts.Block;
[ ]: ts.BreakStatement;
[ ]: ts.CallExpression;
[ ]: ts.CatchClause;
[ ]: ts.CallExpression | ts.ElementAccessExpression | ts.NonNullExpression | ts.PropertyAccessExpression;
[ ]: ts.ClassDeclaration | ts.ClassExpression;
[ ]: ts.ClassDeclaration;
[ ]: ts.ClassExpression;
[ ]: ts.ConditionalExpression;
[ ]: ts.ContinueStatement;
[ ]: ts.DebuggerStatement;
[ ]: ts.Decorator;
[ ]: ts.DoStatement;
[ ]: ts.EmptyStatement;
[ ]: ts.ExportDeclaration;
[ ]: ts.ClassDeclaration | ts.ClassExpression | ts.EnumDeclaration | ts.ExportAssignment | ts.FunctionDeclaration | ts.InterfaceDeclaration | ts.ModuleDeclaration | ts.TypeAliasDeclaration | ts.VariableStatement;
[ ]: ts.ClassDeclaration | ts.ClassExpression | ts.EnumDeclaration | ts.ExportDeclaration | ts.FunctionDeclaration | ts.ImportEqualsDeclaration | ts.InterfaceDeclaration | ts.ModuleDeclaration | ts.TypeAliasDeclaration | ts.VariableStatement;
[ ]: ts.ExportSpecifier;
[ ]: ts.ExpressionStatement;
[ ]: ts.ForInStatement;
[ ]: ts.ForOfStatement;
[ ]: ts.ForStatement;
[ ]: ts.FunctionDeclaration;
[ ]: ts.ConstructorDeclaration | ts.FunctionExpression | ts.GetAccessorDeclaration | ts.MethodDeclaration | ts.SetAccessorDeclaration;
[ ]: ts.ConstructorDeclaration | ts.Identifier | ts.Token<ts.SyntaxKind.ImportKeyword | ts.SyntaxKind.NewKeyword>;
[ ]: ts.IfStatement;
[ ]: ts.PrivateIdentifier;
[ ]: ts.PropertyDeclaration;
[ ]: 'ImportAttribute' extends keyof typeof ts ? ts.ImportAttribute : ts.AssertEntry;
[ ]: ts.ImportDeclaration;
[ ]: ts.ImportClause;
[ ]: ts.CallExpression;
[ ]: ts.NamespaceImport;
[ ]: ts.ImportSpecifier;
[ ]: ts.JsxAttribute;
[ ]: ts.JsxClosingElement;
[ ]: ts.JsxClosingFragment;
[ ]: ts.JsxElement | ts.JsxSelfClosingElement;
[ ]: ts.JsxExpression;
[ ]: ts.JsxExpression;
[ ]: ts.JsxFragment;
[ ]: ts.Identifier | ts.ThisExpression;
[ ]: ts.PropertyAccessExpression;
[ ]: ts.JsxNamespacedName;
[ ]: ts.JsxOpeningElement | ts.JsxSelfClosingElement;
[ ]: ts.JsxOpeningFragment;
[ ]: ts.JsxSpreadAttribute;
[ ]: ts.JsxExpression;
[ ]: ts.JsxText;
[ ]: ts.LabeledStatement;
[ ]: ts.BigIntLiteral | ts.BooleanLiteral | ts.NullLiteral | ts.NumericLiteral | ts.RegularExpressionLiteral | ts.StringLiteral;
[ ]: ts.BinaryExpression;
[ ]: ts.ElementAccessExpression | ts.PropertyAccessExpression;
[ ]: ts.MetaProperty;
[ ]: ts.ConstructorDeclaration | ts.GetAccessorDeclaration | ts.MethodDeclaration | ts.SetAccessorDeclaration;
[ ]: ts.NewExpression;
[ ]: ts.ObjectLiteralExpression;
[ ]: ts.ObjectBindingPattern | ts.ObjectLiteralExpression;
[ ]: ts.SourceFile;
[ ]: ts.BindingElement | ts.GetAccessorDeclaration | ts.MethodDeclaration | ts.PropertyAssignment | ts.SetAccessorDeclaration | ts.ShorthandPropertyAssignment;
[ ]: ts.BindingElement | ts.ParameterDeclaration | ts.SpreadAssignment | ts.SpreadElement;
[ ]: ts.ReturnStatement;
[ ]: ts.BinaryExpression;
[ ]: ts.SpreadAssignment | ts.SpreadElement;
[ ]: ts.ClassStaticBlockDeclaration;
[ ]: ts.SuperExpression;
[ ]: ts.CaseClause | ts.DefaultClause;
[ ]: ts.SwitchStatement;
[ ]: ts.TaggedTemplateExpression;
[ ]: ts.NoSubstitutionTemplateLiteral | ts.TemplateHead | ts.TemplateMiddle | ts.TemplateTail;
[ ]: ts.NoSubstitutionTemplateLiteral | ts.TemplateExpression;
[ ]: ts.Identifier | ts.KeywordTypeNode | ts.ThisExpression;
[ ]: ts.ThrowStatement;
[ ]: ts.TryStatement;
[ ]: ts.PropertyDeclaration;
[ ]: ts.ConstructorDeclaration | ts.GetAccessorDeclaration | ts.MethodDeclaration | ts.SetAccessorDeclaration;
[ ]: ts.PropertyDeclaration;
[ ]: ts.ArrayTypeNode;
[ ]: ts.AsExpression;
[ ]: ts.CallSignatureDeclaration;
[ ]: ts.ExpressionWithTypeArguments;
[ ]: ts.ConditionalTypeNode;
[ ]: ts.ConstructorTypeNode;
[ ]: ts.ConstructSignatureDeclaration;
[ ]: ts.FunctionDeclaration;
[ ]: ts.EnumDeclaration;
[ ]: ts.EnumDeclaration;
[ ]: ts.EnumMember;
[ ]: ts.ExportAssignment;
[ ]: ts.ExternalModuleReference;
[ ]: ts.FunctionTypeNode;
[ ]: ts.ImportEqualsDeclaration;
[ ]: ts.ImportTypeNode;
[ ]: ts.IndexedAccessTypeNode;
[ ]: ts.IndexSignatureDeclaration;
[ ]: ts.InferTypeNode;
[ ]: ts.ExpressionWithTypeArguments;
[ ]: ts.InterfaceDeclaration;
[ ]: ts.InterfaceDeclaration;
[ ]: ts.ExpressionWithTypeArguments;
[ ]: ts.IntersectionTypeNode;
[ ]: ts.LiteralTypeNode;
[ ]: ts.MappedTypeNode;
[ ]: ts.GetAccessorDeclaration | ts.MethodSignature | ts.SetAccessorDeclaration;
[ ]: ts.ModuleBlock;
[ ]: ts.ModuleDeclaration;
[ ]: ts.NamedTupleMember;
[ ]: ts.NamespaceExportDeclaration;
[ ]: ts.NonNullExpression;
[ ]: ts.OptionalTypeNode;
[ ]: ts.ParameterDeclaration;
[ ]: ts.PropertySignature;
[ ]: ts.Identifier | ts.QualifiedName;
[ ]: ts.NamedTupleMember | ts.RestTypeNode;
[ ]: ts.SatisfiesExpression;
[ ]: ts.TemplateLiteralTypeNode;
[ ]: ts.ThisTypeNode;
[ ]: ts.TupleTypeNode;
[ ]: ts.TypeAliasDeclaration;
[ ]: undefined;
[ ]: ts.TypeAssertion;
[ ]: ts.TypeLiteralNode;
[ ]: ts.TypeOperatorNode;
[ ]: ts.TypeParameterDeclaration;
[ ]: undefined;
[ ]: ts.CallExpression | ts.ExpressionWithTypeArguments | ts.ImportTypeNode | ts.JsxOpeningElement | ts.JsxSelfClosingElement | ts.NewExpression | ts.TaggedTemplateExpression | ts.TypeQueryNode | ts.TypeReferenceNode;
[ ]: ts.TypePredicateNode;
[ ]: ts.ImportTypeNode | ts.TypeQueryNode;
[ ]: ts.TypeReferenceNode;
[ ]: ts.UnionTypeNode;
[ ]: ts.DeleteExpression | ts.PostfixUnaryExpression | ts.PrefixUnaryExpression | ts.TypeOfExpression | ts.VoidExpression;
[ ]: ts.PostfixUnaryExpression | ts.PrefixUnaryExpression;
[ ]: ts.VariableDeclarationList | ts.VariableStatement;
[ ]: ts.VariableDeclaration;
[ ]: ts.WhileStatement;
[ ]: ts.WithStatement;
[ ]: ts.YieldExpression;
[ ]: ts.ConstructorDeclaration | ts.FunctionExpression | ts.GetAccessorDeclaration | ts.MethodDeclaration | ts.SetAccessorDeclaration;
[ ]: ts.Token<ts.SyntaxKind.AbstractKeyword>;
[ ]: ts.KeywordTypeNode;
[ ]: ts.KeywordTypeNode;
[ ]: ts.KeywordTypeNode;
[ ]: ts.KeywordTypeNode;
[ ]: ts.KeywordTypeNode;
[ ]: ts.KeywordTypeNode | ts.NullLiteral;
[ ]: ts.KeywordTypeNode;
[ ]: ts.KeywordTypeNode;
[ ]: ts.KeywordTypeNode;
[ ]: ts.KeywordTypeNode;
[ ]: ts.KeywordTypeNode;
[ ]: ts.KeywordTypeNode;
[ ]: ts.KeywordTypeNode;
[ ]: ts.Token<ts.SyntaxKind.AsyncKeyword>;
[ ]: ts.Token<ts.SyntaxKind.DeclareKeyword>;
[ ]: ts.Token<ts.SyntaxKind.ExportKeyword>;
[ ]: ts.Token<ts.SyntaxKind.PrivateKeyword>;
[ ]: ts.Token<ts.SyntaxKind.ProtectedKeyword>;
[ ]: ts.Token<ts.SyntaxKind.PublicKeyword>;
[ ]: ts.Token<ts.SyntaxKind.ReadonlyKeyword>;
[ ]: ts.Token<ts.SyntaxKind.StaticKeyword>;
}
/**
* Maps TSESTree AST Node type to the expected TypeScript AST Node type(s).
* This mapping is based on the internal logic of the parser.
*/
export type TSESTreeToTSNode<T extends TSESTree.Node = TSESTree.Node> = Extract<ts.Token<ts.SyntaxKind.ImportKeyword | ts.SyntaxKind.NewKeyword> | TSNode, EstreeToTsNodeTypes[T['type']]>;
//# sourceMappingURL=estree-to-ts-node-types.d.ts.map