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