@@ -486,10 +486,11 @@ namespace ts {
486486 /* @internal */
487487 export function createCompilerDiagnosticForInvalidCustomType ( opt : CommandLineOptionOfCustomType ) : Diagnostic {
488488 const namesOfType : string [ ] = [ ] ;
489- forEachKey ( opt . type , key => {
490- namesOfType . push ( ` '${ key } '` ) ;
491- } ) ;
492-
489+ for ( const key in opt . type ) {
490+ if ( hasProperty ( opt . type , key ) ) {
491+ namesOfType . push ( ` '${ key } '` ) ;
492+ }
493+ }
493494 return createCompilerDiagnostic ( Diagnostics . Argument_for_0_option_must_be_Colon_1 , `--${ opt . name } ` , namesOfType ) ;
494495 }
495496
@@ -551,11 +552,11 @@ namespace ts {
551552 s = s . slice ( s . charCodeAt ( 1 ) === CharacterCodes . minus ? 2 : 1 ) . toLowerCase ( ) ;
552553
553554 // Try to translate short option names to their full equivalents.
554- if ( hasProperty ( shortOptionNames , s ) ) {
555+ if ( s in shortOptionNames ) {
555556 s = shortOptionNames [ s ] ;
556557 }
557558
558- if ( hasProperty ( optionNameMap , s ) ) {
559+ if ( s in optionNameMap ) {
559560 const opt = optionNameMap [ s ] ;
560561
561562 if ( opt . isTSConfigOnly ) {
@@ -811,7 +812,7 @@ namespace ts {
811812 const optionNameMap = arrayToMap ( optionDeclarations , opt => opt . name ) ;
812813
813814 for ( const id in jsonOptions ) {
814- if ( hasProperty ( optionNameMap , id ) ) {
815+ if ( id in optionNameMap ) {
815816 const opt = optionNameMap [ id ] ;
816817 defaultOptions [ opt . name ] = convertJsonOption ( opt , jsonOptions [ id ] , basePath , errors ) ;
817818 }
@@ -1011,14 +1012,14 @@ namespace ts {
10111012 removeWildcardFilesWithLowerPriorityExtension ( file , wildcardFileMap , supportedExtensions , keyMapper ) ;
10121013
10131014 const key = keyMapper ( file ) ;
1014- if ( ! hasProperty ( literalFileMap , key ) && ! hasProperty ( wildcardFileMap , key ) ) {
1015+ if ( ! ( key in literalFileMap ) && ! ( key in wildcardFileMap ) ) {
10151016 wildcardFileMap [ key ] = file ;
10161017 }
10171018 }
10181019 }
10191020
1020- const literalFiles = reduceProperties ( literalFileMap , addFileToOutput , [ ] ) ;
1021- const wildcardFiles = reduceProperties ( wildcardFileMap , addFileToOutput , [ ] ) ;
1021+ const literalFiles = reduceOwnProperties ( literalFileMap , addFileToOutput , [ ] ) ;
1022+ const wildcardFiles = reduceOwnProperties ( wildcardFileMap , addFileToOutput , [ ] ) ;
10221023 wildcardFiles . sort ( host . useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive ) ;
10231024 return {
10241025 fileNames : literalFiles . concat ( wildcardFiles ) ,
@@ -1076,7 +1077,7 @@ namespace ts {
10761077 if ( match ) {
10771078 const key = useCaseSensitiveFileNames ? match [ 0 ] : match [ 0 ] . toLowerCase ( ) ;
10781079 const flags = watchRecursivePattern . test ( name ) ? WatchDirectoryFlags . Recursive : WatchDirectoryFlags . None ;
1079- const existingFlags = getProperty ( wildcardDirectories , key ) ;
1080+ const existingFlags = wildcardDirectories [ key ] ;
10801081 if ( existingFlags === undefined || existingFlags < flags ) {
10811082 wildcardDirectories [ key ] = flags ;
10821083 if ( flags === WatchDirectoryFlags . Recursive ) {
@@ -1088,11 +1089,9 @@ namespace ts {
10881089
10891090 // Remove any subpaths under an existing recursively watched directory.
10901091 for ( const key in wildcardDirectories ) {
1091- if ( hasProperty ( wildcardDirectories , key ) ) {
1092- for ( const recursiveKey of recursiveKeys ) {
1093- if ( key !== recursiveKey && containsPath ( recursiveKey , key , path , ! useCaseSensitiveFileNames ) ) {
1094- delete wildcardDirectories [ key ] ;
1095- }
1092+ for ( const recursiveKey of recursiveKeys ) {
1093+ if ( key !== recursiveKey && containsPath ( recursiveKey , key , path , ! useCaseSensitiveFileNames ) ) {
1094+ delete wildcardDirectories [ key ] ;
10961095 }
10971096 }
10981097 }
@@ -1115,7 +1114,7 @@ namespace ts {
11151114 for ( let i = ExtensionPriority . Highest ; i < adjustedExtensionPriority ; i ++ ) {
11161115 const higherPriorityExtension = extensions [ i ] ;
11171116 const higherPriorityPath = keyMapper ( changeExtension ( file , higherPriorityExtension ) ) ;
1118- if ( hasProperty ( literalFiles , higherPriorityPath ) || hasProperty ( wildcardFiles , higherPriorityPath ) ) {
1117+ if ( higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles ) {
11191118 return true ;
11201119 }
11211120 }
0 commit comments