Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / @typescript-eslint / typescript-estree / dist / convert.d.ts
1 import * as ts from 'typescript';
2 import { TSError } from './node-utils';
3 import { ParserWeakMap, ParserWeakMapESTreeToTSNode } from './parser-options';
4 import { TSESTree, TSNode } from './ts-estree';
5 interface ConverterOptions {
6     errorOnUnknownASTType: boolean;
7     useJSXTextNode: boolean;
8     shouldPreserveNodeMaps: boolean;
9 }
10 /**
11  * Extends and formats a given error object
12  * @param error the error object
13  * @returns converted error object
14  */
15 export declare function convertError(error: any): TSError;
16 export interface ASTMaps {
17     esTreeNodeToTSNodeMap: ParserWeakMapESTreeToTSNode;
18     tsNodeToESTreeNodeMap: ParserWeakMap<TSNode, TSESTree.Node>;
19 }
20 export declare class Converter {
21     private readonly ast;
22     private readonly options;
23     private readonly esTreeNodeToTSNodeMap;
24     private readonly tsNodeToESTreeNodeMap;
25     private allowPattern;
26     private inTypeMode;
27     /**
28      * Converts a TypeScript node into an ESTree node
29      * @param ast the full TypeScript AST
30      * @param options additional options for the conversion
31      * @returns the converted ESTreeNode
32      */
33     constructor(ast: ts.SourceFile, options: ConverterOptions);
34     getASTMaps(): ASTMaps;
35     convertProgram(): TSESTree.Program;
36     /**
37      * Converts a TypeScript node into an ESTree node.
38      * @param node the child ts.Node
39      * @param parent parentNode
40      * @param inTypeMode flag to determine if we are in typeMode
41      * @param allowPattern flag to determine if patterns are allowed
42      * @returns the converted ESTree node
43      */
44     private converter;
45     /**
46      * Fixes the exports of the given ts.Node
47      * @param node the ts.Node
48      * @param result result
49      * @returns the ESTreeNode with fixed exports
50      */
51     private fixExports;
52     /**
53      * Register specific TypeScript node into map with first ESTree node provided
54      */
55     private registerTSNodeInNodeMap;
56     /**
57      * Converts a TypeScript node into an ESTree node.
58      * @param child the child ts.Node
59      * @param parent parentNode
60      * @returns the converted ESTree node
61      */
62     private convertPattern;
63     /**
64      * Converts a TypeScript node into an ESTree node.
65      * @param child the child ts.Node
66      * @param parent parentNode
67      * @returns the converted ESTree node
68      */
69     private convertChild;
70     /**
71      * Converts a TypeScript node into an ESTree node.
72      * @param child the child ts.Node
73      * @param parent parentNode
74      * @returns the converted ESTree node
75      */
76     private convertType;
77     private createNode;
78     private convertBindingNameWithTypeAnnotation;
79     /**
80      * Converts a child into a type annotation. This creates an intermediary
81      * TypeAnnotation node to match what Flow does.
82      * @param child The TypeScript AST node to convert.
83      * @param parent parentNode
84      * @returns The type annotation node.
85      */
86     private convertTypeAnnotation;
87     /**
88      * Coverts body Nodes and add a directive field to StringLiterals
89      * @param nodes of ts.Node
90      * @param parent parentNode
91      * @returns Array of body statements
92      */
93     private convertBodyExpressions;
94     /**
95      * Converts a ts.Node's typeArguments to TSTypeParameterInstantiation node
96      * @param typeArguments ts.NodeArray typeArguments
97      * @param node parent used to create this node
98      * @returns TypeParameterInstantiation node
99      */
100     private convertTypeArgumentsToTypeParameters;
101     /**
102      * Converts a ts.Node's typeParameters to TSTypeParameterDeclaration node
103      * @param typeParameters ts.Node typeParameters
104      * @returns TypeParameterDeclaration node
105      */
106     private convertTSTypeParametersToTypeParametersDeclaration;
107     /**
108      * Converts an array of ts.Node parameters into an array of ESTreeNode params
109      * @param parameters An array of ts.Node params to be converted
110      * @returns an array of converted ESTreeNode params
111      */
112     private convertParameters;
113     /**
114      * For nodes that are copied directly from the TypeScript AST into
115      * ESTree mostly as-is. The only difference is the addition of a type
116      * property instead of a kind property. Recursively copies all children.
117      */
118     private deeplyCopy;
119     /**
120      * Converts a TypeScript JSX node.tagName into an ESTree node.name
121      * @param node the tagName object from a JSX ts.Node
122      * @param parent
123      * @returns the converted ESTree name object
124      */
125     private convertJSXTagName;
126     /**
127      * Applies the given TS modifiers to the given result object.
128      * @param result
129      * @param modifiers original ts.Nodes from the node.modifiers array
130      * @returns the current result object will be mutated
131      * @deprecated This method adds not standardized `modifiers` property in nodes
132      */
133     private applyModifiersToResult;
134     /**
135      * Uses the provided range location to adjust the location data of the given Node
136      * @param result The node that will have its location data mutated
137      * @param childRange The child node range used to expand location
138      */
139     private fixParentLocation;
140     /**
141      * Converts a TypeScript node into an ESTree node.
142      * The core of the conversion logic:
143      * Identify and convert each relevant TypeScript SyntaxKind
144      * @param node the child ts.Node
145      * @param parent parentNode
146      * @returns the converted ESTree node
147      */
148     private convertNode;
149 }
150 export {};
151 //# sourceMappingURL=convert.d.ts.map