/
types.ts
30 lines (28 loc) · 1.5 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import type ts from 'typescript';
import type { GraphQLSchema, DocumentNode, FragmentDefinitionNode } from 'graphql';
import type { ScriptSourceHelper, ResolveResult } from '../ts-ast-util';
import type { SchemaBuildErrorInfo } from '../schema-manager/schema-manager';
export type GetCompletionAtPosition = ts.LanguageService['getCompletionsAtPosition'];
export type GetSemanticDiagnostics = ts.LanguageService['getSemanticDiagnostics'];
export type GetQuickInfoAtPosition = ts.LanguageService['getQuickInfoAtPosition'];
export type GetDefinitionAtPosition = ts.LanguageService['getDefinitionAtPosition'];
export interface AnalysisContext {
debug(msg: string): void;
getScriptSourceHelper(): ScriptSourceHelper;
getSchema(): GraphQLSchema | null | undefined;
getSchemaOrSchemaErrors(): [GraphQLSchema, null] | [null, SchemaBuildErrorInfo[]];
getGlobalFragmentDefinitions(): FragmentDefinitionNode[];
getExternalFragmentDefinitions(
documentStr: string,
fileName: string,
sourcePosition: number,
): FragmentDefinitionNode[];
getDuplicaterdFragmentDefinitions(): Set<string>;
getGraphQLDocumentNode(text: string): DocumentNode | undefined;
findAscendantTemplateNode(
fileName: string,
position: number,
): ts.NoSubstitutionTemplateLiteral | ts.TemplateExpression | undefined;
findTemplateNodes(fileName: string): (ts.NoSubstitutionTemplateLiteral | ts.TemplateExpression)[];
resolveTemplateInfo(fileName: string, node: ts.TemplateExpression | ts.NoSubstitutionTemplateLiteral): ResolveResult;
}