File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1925,15 +1925,17 @@ namespace ts {
19251925 const allSupportedExtensions = supportedTypeScriptExtensions . concat ( supportedJavascriptExtensions ) ;
19261926
19271927 export function getSupportedExtensions ( options ?: CompilerOptions , extraFileExtensions ?: FileExtensionInfo [ ] ) : string [ ] {
1928- let typeScriptHostExtensions : string [ ] = [ ] ;
1929- let allHostExtensions : string [ ] = [ ] ;
1930- if ( extraFileExtensions ) {
1931- allHostExtensions = ts . map ( extraFileExtensions , item => item . extension ) ;
1932- typeScriptHostExtensions = ts . map ( ts . filter ( extraFileExtensions , item => item . scriptKind === ScriptKind . TS ) , item => item . extension ) ;
1933- }
1934- const allTypeScriptExtensions = concatenate ( supportedTypeScriptExtensions , typeScriptHostExtensions ) ;
1935- const allExtensions = concatenate ( allSupportedExtensions , allHostExtensions ) ;
1936- return options && options . allowJs ? allExtensions : allTypeScriptExtensions ;
1928+ const needAllExtensions = options && options . allowJs ;
1929+ if ( ! extraFileExtensions || extraFileExtensions . length === 0 ) {
1930+ return needAllExtensions ? allSupportedExtensions : supportedTypeScriptExtensions ;
1931+ }
1932+ const extensions = ( needAllExtensions ? allSupportedExtensions : supportedTypeScriptExtensions ) . slice ( 0 ) ;
1933+ for ( const extInfo of extraFileExtensions ) {
1934+ if ( needAllExtensions || extInfo . scriptKind === ScriptKind . TS ) {
1935+ extensions . push ( extInfo . extension ) ;
1936+ }
1937+ }
1938+ return extensions ;
19371939 }
19381940
19391941 export function hasJavaScriptFileExtension ( fileName : string ) {
You can’t perform that action at this time.
0 commit comments