• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1declare namespace ts.server {
2    export interface TypingInstallerResponse {
3        readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed;
4    }
5
6    export interface TypingInstallerRequestWithProjectName {
7        readonly projectName: string;
8    }
9
10    /* @internal */
11    export type TypingInstallerRequestUnion = DiscoverTypings | CloseProject | TypesRegistryRequest | InstallPackageRequest;
12
13    export interface DiscoverTypings extends TypingInstallerRequestWithProjectName {
14        readonly fileNames: string[];
15        readonly projectRootPath: Path;
16        readonly compilerOptions: CompilerOptions;
17        readonly watchOptions?: WatchOptions;
18        readonly typeAcquisition: TypeAcquisition;
19        readonly unresolvedImports: SortedReadonlyArray<string>;
20        readonly cachePath?: string;
21        readonly kind: "discover";
22    }
23
24    export interface CloseProject extends TypingInstallerRequestWithProjectName {
25        readonly kind: "closeProject";
26    }
27
28    export interface TypesRegistryRequest {
29        readonly kind: "typesRegistry";
30    }
31
32    export interface InstallPackageRequest extends TypingInstallerRequestWithProjectName {
33        readonly kind: "installPackage";
34        readonly fileName: Path;
35        readonly packageName: string;
36        readonly projectRootPath: Path;
37    }
38
39    /* @internal */
40    export interface TypesRegistryResponse extends TypingInstallerResponse {
41        readonly kind: EventTypesRegistry;
42        readonly typesRegistry: MapLike<MapLike<string>>;
43    }
44
45    export interface PackageInstalledResponse extends ProjectResponse {
46        readonly kind: ActionPackageInstalled;
47        readonly success: boolean;
48        readonly message: string;
49    }
50
51    export interface InitializationFailedResponse extends TypingInstallerResponse {
52        readonly kind: EventInitializationFailed;
53        readonly message: string;
54        readonly stack?: string;
55    }
56
57    export interface ProjectResponse extends TypingInstallerResponse {
58        readonly projectName: string;
59    }
60
61    export interface InvalidateCachedTypings extends ProjectResponse {
62        readonly kind: ActionInvalidate;
63    }
64
65    export interface InstallTypes extends ProjectResponse {
66        readonly kind: EventBeginInstallTypes | EventEndInstallTypes;
67        readonly eventId: number;
68        readonly typingsInstallerVersion: string;
69        readonly packagesToInstall: readonly string[];
70    }
71
72    export interface BeginInstallTypes extends InstallTypes {
73        readonly kind: EventBeginInstallTypes;
74    }
75
76    export interface EndInstallTypes extends InstallTypes {
77        readonly kind: EventEndInstallTypes;
78        readonly installSuccess: boolean;
79    }
80
81    /* @internal */
82    export interface InstallTypingHost extends JsTyping.TypingResolutionHost {
83        useCaseSensitiveFileNames: boolean;
84        writeFile(path: string, content: string): void;
85        createDirectory(path: string): void;
86        getCurrentDirectory?(): string;
87        watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number, options?: WatchOptions): FileWatcher;
88        watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean, options?: WatchOptions): FileWatcher;
89    }
90
91    export interface SetTypings extends ProjectResponse {
92        readonly typeAcquisition: TypeAcquisition;
93        readonly compilerOptions: CompilerOptions;
94        readonly typings: string[];
95        readonly unresolvedImports: SortedReadonlyArray<string>;
96        readonly kind: ActionSet;
97    }
98
99    /* @internal */
100    export type TypingInstallerResponseUnion = SetTypings | InvalidateCachedTypings | TypesRegistryResponse | PackageInstalledResponse | InstallTypes | InitializationFailedResponse;
101}
102