@@ -556,22 +556,13 @@ namespace ts.server {
556
556
557
557
function startNodeServer ( options : LaunchOptions ) {
558
558
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
-
570
559
interface QueuedOperation {
571
560
operationId : string ;
572
561
operation : ( ) => void ;
573
562
}
574
563
564
+ type ResponseType = TypesRegistryResponse | PackageInstalledResponse | SetTypings | InvalidateCachedTypings | BeginInstallTypes | EndInstallTypes | InitializationFailedResponse ;
565
+
575
566
class NodeTypingsInstaller implements ITypingsInstaller {
576
567
577
568
public static getGlobalTypingsCacheLocation ( ) {
@@ -616,7 +607,7 @@ namespace ts.server {
616
607
return combinePaths ( normalizeSlashes ( homePath ) , cacheFolder ) ;
617
608
}
618
609
619
- private installer ! : NodeChildProcess ;
610
+ private installer ! : import ( "child_process" ) . ChildProcess ;
620
611
private projectService ! : ProjectService ;
621
612
private activeRequestCount = 0 ;
622
613
private requestQueue : QueuedOperation [ ] = [ ] ;
@@ -711,7 +702,7 @@ namespace ts.server {
711
702
}
712
703
713
704
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 ) ) ;
715
706
716
707
this . event ( { pid : this . installer . pid } , "typingsInstallerPid" ) ;
717
708
@@ -757,7 +748,7 @@ namespace ts.server {
757
748
}
758
749
}
759
750
760
- private handleMessage ( response : TypesRegistryResponse | PackageInstalledResponse | SetTypings | InvalidateCachedTypings | BeginInstallTypes | EndInstallTypes | InitializationFailedResponse ) {
751
+ private handleMessage ( response : ResponseType ) {
761
752
if ( this . logger . hasLevel ( LogLevel . verbose ) ) {
762
753
this . logger . info ( `Received response:${ stringifyIndented ( response ) } ` ) ;
763
754
}
@@ -869,7 +860,7 @@ namespace ts.server {
869
860
870
861
class IOSession extends Session {
871
862
private eventPort : number | undefined ;
872
- private eventSocket : NodeSocket | undefined ;
863
+ private eventSocket : import ( "net" ) . Socket | undefined ;
873
864
private socketEventQueue : { body : any , eventName : string } [ ] | undefined ;
874
865
private constructed : boolean | undefined ;
875
866
private readonly rl : import ( "readline" ) . Interface ;
0 commit comments