UNPKG

1.07 kBTypeScriptView Raw
1import type * as ts from 'typescript';
2import type { ParserServices, TSESTreeOptions } from './parser-options';
3import type { TSESTree } from './ts-estree';
4declare function clearProgramCache(): void;
5interface EmptyObject {
6}
7type AST<T extends TSESTreeOptions> = TSESTree.Program & (T['comment'] extends true ? {
8 comments: TSESTree.Comment[];
9} : EmptyObject) & (T['tokens'] extends true ? {
10 tokens: TSESTree.Token[];
11} : EmptyObject);
12interface ParseAndGenerateServicesResult<T extends TSESTreeOptions> {
13 ast: AST<T>;
14 services: ParserServices;
15}
16declare function parse<T extends TSESTreeOptions = TSESTreeOptions>(code: string, options?: T): AST<T>;
17declare function clearParseAndGenerateServicesCalls(): void;
18declare function parseAndGenerateServices<T extends TSESTreeOptions = TSESTreeOptions>(code: ts.SourceFile | string, options: T): ParseAndGenerateServicesResult<T>;
19export { AST, parse, parseAndGenerateServices, ParseAndGenerateServicesResult, clearProgramCache, clearParseAndGenerateServicesCalls, };
20//# sourceMappingURL=parser.d.ts.map
\No newline at end of file