• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// These types are internal to TS.
2// They have been trimmed down to only include the relevant bits
3// We use some special internal TS apis to help us do our parsing flexibly
4
5import * as ts from 'typescript';
6
7// https://github.com/microsoft/TypeScript/blob/b84e65db4ea5c39dbaa2ccd6594efe4653318251/src/compiler/watchUtilities.ts#L6-L18
8interface DirectoryStructureHost {
9  readDirectory?(
10    path: string,
11    extensions?: ReadonlyArray<string>,
12    exclude?: ReadonlyArray<string>,
13    include?: ReadonlyArray<string>,
14    depth?: number,
15  ): string[];
16}
17
18// https://github.com/microsoft/TypeScript/blob/b84e65db4ea5c39dbaa2ccd6594efe4653318251/src/compiler/watchUtilities.ts#L25-L35
19interface CachedDirectoryStructureHost extends DirectoryStructureHost {
20  readDirectory(
21    path: string,
22    extensions?: ReadonlyArray<string>,
23    exclude?: ReadonlyArray<string>,
24    include?: ReadonlyArray<string>,
25    depth?: number,
26  ): string[];
27}
28
29// https://github.com/microsoft/TypeScript/blob/5d36aab06f12b0a3ba6197eb14e98204ec0195fb/src/compiler/watch.ts#L548-L554
30interface WatchCompilerHostOfConfigFile<T extends ts.BuilderProgram>
31  extends ts.WatchCompilerHostOfConfigFile<T> {
32  onCachedDirectoryStructureHostCreate(
33    host: CachedDirectoryStructureHost,
34  ): void;
35  extraFileExtensions?: readonly ts.FileExtensionInfo[];
36}
37
38export { WatchCompilerHostOfConfigFile };
39