.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / tsutils / util / convert-ast.d.ts
1 import * as ts from 'typescript';\r
2 /** Wraps an AST node. Can be used as a tree using `children` or a linked list using `next` and `skip`. */\r
3 export interface NodeWrap {\r
4     /** The real AST node. */\r
5     node: ts.Node;\r
6     /** The SyntaxKind of `node`. */\r
7     kind: ts.SyntaxKind;\r
8     /** All immediate children of `node` that would be visited by `ts.forEachChild(node, cb)`. */\r
9     children: NodeWrap[];\r
10     /** Link to the next NodeWrap, depth-first. */\r
11     next?: NodeWrap;\r
12     /** Link to the next NodeWrap skipping all children of the current node. */\r
13     skip?: NodeWrap;\r
14     /** Link to the parent NodeWrap */\r
15     parent?: NodeWrap;\r
16 }\r
17 export interface WrappedAst extends NodeWrap {\r
18     node: ts.SourceFile;\r
19     next: NodeWrap;\r
20     skip: undefined;\r
21     parent: undefined;\r
22 }\r
23 export interface ConvertedAst {\r
24     /** nodes wrapped in a data structure with useful links */\r
25     wrapped: WrappedAst;\r
26     /** depth-first array of all nodes excluding SourceFile */\r
27     flat: ReadonlyArray<ts.Node>;\r
28 }\r
29 /**\r
30  * Takes a `ts.SourceFile` and creates data structures that are easier (or more performant) to traverse.\r
31  * Note that there is only a performance gain if you can reuse these structures. It's not recommended for one-time AST walks.\r
32  */\r
33 export declare function convertAst(sourceFile: ts.SourceFile): ConvertedAst;\r