@@ -61,10 +61,10 @@ namespace ts {
6161 } ,
6262 {
6363 name : "jsx" ,
64- type : {
64+ type : createMap ( {
6565 "preserve" : JsxEmit . Preserve ,
6666 "react" : JsxEmit . React
67- } ,
67+ } ) ,
6868 paramType : Diagnostics . KIND ,
6969 description : Diagnostics . Specify_JSX_code_generation_Colon_preserve_or_react ,
7070 } ,
@@ -91,24 +91,24 @@ namespace ts {
9191 {
9292 name : "module" ,
9393 shortName : "m" ,
94- type : {
94+ type : createMap ( {
9595 "none" : ModuleKind . None ,
9696 "commonjs" : ModuleKind . CommonJS ,
9797 "amd" : ModuleKind . AMD ,
9898 "system" : ModuleKind . System ,
9999 "umd" : ModuleKind . UMD ,
100100 "es6" : ModuleKind . ES6 ,
101101 "es2015" : ModuleKind . ES2015 ,
102- } ,
102+ } ) ,
103103 description : Diagnostics . Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015 ,
104104 paramType : Diagnostics . KIND ,
105105 } ,
106106 {
107107 name : "newLine" ,
108- type : {
108+ type : createMap ( {
109109 "crlf" : NewLineKind . CarriageReturnLineFeed ,
110110 "lf" : NewLineKind . LineFeed
111- } ,
111+ } ) ,
112112 description : Diagnostics . Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix ,
113113 paramType : Diagnostics . NEWLINE ,
114114 } ,
@@ -250,12 +250,12 @@ namespace ts {
250250 {
251251 name : "target" ,
252252 shortName : "t" ,
253- type : {
253+ type : createMap ( {
254254 "es3" : ScriptTarget . ES3 ,
255255 "es5" : ScriptTarget . ES5 ,
256256 "es6" : ScriptTarget . ES6 ,
257257 "es2015" : ScriptTarget . ES2015 ,
258- } ,
258+ } ) ,
259259 description : Diagnostics . Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015 ,
260260 paramType : Diagnostics . VERSION ,
261261 } ,
@@ -284,10 +284,10 @@ namespace ts {
284284 } ,
285285 {
286286 name : "moduleResolution" ,
287- type : {
287+ type : createMap ( {
288288 "node" : ModuleResolutionKind . NodeJs ,
289289 "classic" : ModuleResolutionKind . Classic ,
290- } ,
290+ } ) ,
291291 description : Diagnostics . Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6 ,
292292 } ,
293293 {
@@ -392,7 +392,7 @@ namespace ts {
392392 type : "list" ,
393393 element : {
394394 name : "lib" ,
395- type : {
395+ type : createMap ( {
396396 // JavaScript only
397397 "es5" : "lib.es5.d.ts" ,
398398 "es6" : "lib.es2015.d.ts" ,
@@ -417,7 +417,7 @@ namespace ts {
417417 "es2016.array.include" : "lib.es2016.array.include.d.ts" ,
418418 "es2017.object" : "lib.es2017.object.d.ts" ,
419419 "es2017.sharedmemory" : "lib.es2017.sharedmemory.d.ts"
420- } ,
420+ } ) ,
421421 } ,
422422 description : Diagnostics . Specify_library_files_to_be_included_in_the_compilation_Colon
423423 } ,
@@ -486,18 +486,17 @@ namespace ts {
486486 /* @internal */
487487 export function createCompilerDiagnosticForInvalidCustomType ( opt : CommandLineOptionOfCustomType ) : Diagnostic {
488488 const namesOfType : string [ ] = [ ] ;
489- forEachKey ( opt . type , key => {
489+ for ( const key in opt . type ) {
490490 namesOfType . push ( ` '${ key } '` ) ;
491- } ) ;
492-
491+ }
493492 return createCompilerDiagnostic ( Diagnostics . Argument_for_0_option_must_be_Colon_1 , `--${ opt . name } ` , namesOfType ) ;
494493 }
495494
496495 /* @internal */
497496 export function parseCustomTypeOption ( opt : CommandLineOptionOfCustomType , value : string , errors : Diagnostic [ ] ) {
498497 const key = trimString ( ( value || "" ) ) . toLowerCase ( ) ;
499498 const map = opt . type ;
500- if ( hasProperty ( map , key ) ) {
499+ if ( key in map ) {
501500 return map [ key ] ;
502501 }
503502 else {
@@ -551,11 +550,11 @@ namespace ts {
551550 s = s . slice ( s . charCodeAt ( 1 ) === CharacterCodes . minus ? 2 : 1 ) . toLowerCase ( ) ;
552551
553552 // Try to translate short option names to their full equivalents.
554- if ( hasProperty ( shortOptionNames , s ) ) {
553+ if ( s in shortOptionNames ) {
555554 s = shortOptionNames [ s ] ;
556555 }
557556
558- if ( hasProperty ( optionNameMap , s ) ) {
557+ if ( s in optionNameMap ) {
559558 const opt = optionNameMap [ s ] ;
560559
561560 if ( opt . isTSConfigOnly ) {
@@ -811,7 +810,7 @@ namespace ts {
811810 const optionNameMap = arrayToMap ( optionDeclarations , opt => opt . name ) ;
812811
813812 for ( const id in jsonOptions ) {
814- if ( hasProperty ( optionNameMap , id ) ) {
813+ if ( id in optionNameMap ) {
815814 const opt = optionNameMap [ id ] ;
816815 defaultOptions [ opt . name ] = convertJsonOption ( opt , jsonOptions [ id ] , basePath , errors ) ;
817816 }
@@ -848,7 +847,7 @@ namespace ts {
848847
849848 function convertJsonOptionOfCustomType ( opt : CommandLineOptionOfCustomType , value : string , errors : Diagnostic [ ] ) {
850849 const key = value . toLowerCase ( ) ;
851- if ( hasProperty ( opt . type , key ) ) {
850+ if ( key in opt . type ) {
852851 return opt . type [ key ] ;
853852 }
854853 else {
@@ -1011,7 +1010,7 @@ namespace ts {
10111010 removeWildcardFilesWithLowerPriorityExtension ( file , wildcardFileMap , supportedExtensions , keyMapper ) ;
10121011
10131012 const key = keyMapper ( file ) ;
1014- if ( ! hasProperty ( literalFileMap , key ) && ! hasProperty ( wildcardFileMap , key ) ) {
1013+ if ( ! ( key in literalFileMap ) && ! ( key in wildcardFileMap ) ) {
10151014 wildcardFileMap [ key ] = file ;
10161015 }
10171016 }
@@ -1076,7 +1075,7 @@ namespace ts {
10761075 if ( match ) {
10771076 const key = useCaseSensitiveFileNames ? match [ 0 ] : match [ 0 ] . toLowerCase ( ) ;
10781077 const flags = watchRecursivePattern . test ( name ) ? WatchDirectoryFlags . Recursive : WatchDirectoryFlags . None ;
1079- const existingFlags = getProperty ( wildcardDirectories , key ) ;
1078+ const existingFlags = wildcardDirectories [ key ] ;
10801079 if ( existingFlags === undefined || existingFlags < flags ) {
10811080 wildcardDirectories [ key ] = flags ;
10821081 if ( flags === WatchDirectoryFlags . Recursive ) {
@@ -1088,11 +1087,9 @@ namespace ts {
10881087
10891088 // Remove any subpaths under an existing recursively watched directory.
10901089 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- }
1090+ for ( const recursiveKey of recursiveKeys ) {
1091+ if ( key !== recursiveKey && containsPath ( recursiveKey , key , path , ! useCaseSensitiveFileNames ) ) {
1092+ delete wildcardDirectories [ key ] ;
10961093 }
10971094 }
10981095 }
@@ -1115,7 +1112,7 @@ namespace ts {
11151112 for ( let i = ExtensionPriority . Highest ; i < adjustedExtensionPriority ; i ++ ) {
11161113 const higherPriorityExtension = extensions [ i ] ;
11171114 const higherPriorityPath = keyMapper ( changeExtension ( file , higherPriorityExtension ) ) ;
1118- if ( hasProperty ( literalFiles , higherPriorityPath ) || hasProperty ( wildcardFiles , higherPriorityPath ) ) {
1115+ if ( higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles ) {
11191116 return true ;
11201117 }
11211118 }
0 commit comments