Skip to content

Commit 4ce8d4a

Browse files
committed
Remove some inlined note types
Use import types instead
1 parent fb900a0 commit 4ce8d4a

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

src/tsserver/server.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -556,22 +556,13 @@ namespace ts.server {
556556

557557
function startNodeServer(options: LaunchOptions) {
558558

559-
interface NodeSocket {
560-
write(data: string, encoding: string): boolean;
561-
}
562-
563-
interface NodeChildProcess {
564-
send(message: any, sendHandle?: any): void;
565-
on(message: "message" | "exit", f: (m: any) => void): void;
566-
kill(): void;
567-
pid: number;
568-
}
569-
570559
interface QueuedOperation {
571560
operationId: string;
572561
operation: () => void;
573562
}
574563

564+
type ResponseType = TypesRegistryResponse | PackageInstalledResponse | SetTypings | InvalidateCachedTypings | BeginInstallTypes | EndInstallTypes | InitializationFailedResponse;
565+
575566
class NodeTypingsInstaller implements ITypingsInstaller {
576567

577568
public static getGlobalTypingsCacheLocation() {
@@ -616,7 +607,7 @@ namespace ts.server {
616607
return combinePaths(normalizeSlashes(homePath), cacheFolder);
617608
}
618609

619-
private installer!: NodeChildProcess;
610+
private installer!: import("child_process").ChildProcess;
620611
private projectService!: ProjectService;
621612
private activeRequestCount = 0;
622613
private requestQueue: QueuedOperation[] = [];
@@ -711,7 +702,7 @@ namespace ts.server {
711702
}
712703

713704
this.installer = require("child_process").fork(combinePaths(__dirname, "typingsInstaller.js"), args, { execArgv });
714-
this.installer.on("message", m => this.handleMessage(m));
705+
this.installer.on("message", m => this.handleMessage(m as ResponseType));
715706

716707
this.event({ pid: this.installer.pid }, "typingsInstallerPid");
717708

@@ -757,7 +748,7 @@ namespace ts.server {
757748
}
758749
}
759750

760-
private handleMessage(response: TypesRegistryResponse | PackageInstalledResponse | SetTypings | InvalidateCachedTypings | BeginInstallTypes | EndInstallTypes | InitializationFailedResponse) {
751+
private handleMessage(response: ResponseType) {
761752
if (this.logger.hasLevel(LogLevel.verbose)) {
762753
this.logger.info(`Received response:${stringifyIndented(response)}`);
763754
}
@@ -869,7 +860,7 @@ namespace ts.server {
869860

870861
class IOSession extends Session {
871862
private eventPort: number | undefined;
872-
private eventSocket: NodeSocket | undefined;
863+
private eventSocket: import("net").Socket | undefined;
873864
private socketEventQueue: { body: any, eventName: string }[] | undefined;
874865
private constructed: boolean | undefined;
875866
private readonly rl: import("readline").Interface;

0 commit comments

Comments
 (0)