File tree Expand file tree Collapse file tree 1 file changed +24
-14
lines changed Expand file tree Collapse file tree 1 file changed +24
-14
lines changed Original file line number Diff line number Diff line change @@ -1123,7 +1123,7 @@ namespace ts.server {
11231123 }
11241124 }
11251125
1126- function start ( args : string [ ] ) {
1126+ function start ( args : readonly string [ ] ) {
11271127 const serverMode = parseServerMode ( ) ;
11281128 const syntaxOnly = hasArgument ( "--syntaxOnly" ) || runtime !== Runtime . Node ;
11291129
@@ -1155,19 +1155,29 @@ namespace ts.server {
11551155 }
11561156 }
11571157
1158- if ( runtime === Runtime . Node ) {
1159- start ( process . argv ) ;
1160- }
1161- else {
1162- // Get args from first message
1163- const listener = ( e : any ) => {
1164- removeEventListener ( "message" , listener ) ;
1165-
1166- const args = e . data ;
1167- sys . args = args ;
1168- start ( args ) ;
1169- } ;
1158+ switch ( runtime ) {
1159+ case Runtime . Node :
1160+ {
1161+ start ( process . argv ) ;
1162+ break ;
1163+ }
1164+ case Runtime . Web :
1165+ {
1166+ // Get args from first message
1167+ const listener = ( e : any ) => {
1168+ removeEventListener ( "message" , listener ) ;
1169+
1170+ const args = e . data ;
1171+ sys . args = args ;
1172+ start ( args ) ;
1173+ } ;
11701174
1171- addEventListener ( "message" , listener ) ;
1175+ addEventListener ( "message" , listener ) ;
1176+ break ;
1177+ }
1178+ default :
1179+ {
1180+ throw new Error ( "Unknown runtime" ) ;
1181+ }
11721182 }
11731183}
You can’t perform that action at this time.
0 commit comments