@@ -2798,7 +2798,7 @@ export function generateTSConfig(options: CompilerOptions, newLine: string): str
27982798
27992799 const tab = " " ;
28002800 const result : string [ ] = [ ] ;
2801- const allSetOptions = Object . keys ( options ) . filter ( k => k !== "init" && k !== "help" && k !== "watch" ) ;
2801+ const allSetOptions = Object . keys ( options ) . filter ( k => k !== "init" && k !== "help" && k !== "watch" ) as ( string & keyof CompilerOptions ) [ ] ;
28022802
28032803 result . push ( `{` ) ;
28042804 result . push ( `${ tab } // ${ getLocaleSpecificMessage ( Diagnostics . Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file ) } ` ) ;
@@ -2861,7 +2861,7 @@ export function generateTSConfig(options: CompilerOptions, newLine: string): str
28612861 if ( allSetOptions . length > 0 ) {
28622862 newline ( ) ;
28632863 while ( allSetOptions . length > 0 ) {
2864- emitOption ( allSetOptions [ 0 ] , options [ allSetOptions [ 0 ] ] as PresetValue ) ;
2864+ emitOption ( allSetOptions [ 0 ] , options [ allSetOptions [ 0 ] ] ) ;
28652865 }
28662866 }
28672867
@@ -2876,7 +2876,7 @@ export function generateTSConfig(options: CompilerOptions, newLine: string): str
28762876 // commented = 'always': Always comment this out, even if it's on commandline
28772877 // commented = 'optional': Comment out unless it's on commandline
28782878 // commented = 'never': Never comment this out
2879- function emitOption ( setting : string , defaultValue : PresetValue , commented : "always" | "optional" | "never" = "never" ) {
2879+ function emitOption < K extends string & keyof CompilerOptions > ( setting : K , defaultValue : CompilerOptions [ K ] , commented : "always" | "optional" | "never" = "never" ) {
28802880 const existingOptionIndex = allSetOptions . indexOf ( setting ) ;
28812881 if ( existingOptionIndex >= 0 ) {
28822882 allSetOptions . splice ( existingOptionIndex , 1 ) ;
0 commit comments