@@ -61,10 +61,10 @@ namespace ts {
61
61
} ,
62
62
{
63
63
name : "jsx" ,
64
- type : {
64
+ type : createMap ( {
65
65
"preserve" : JsxEmit . Preserve ,
66
66
"react" : JsxEmit . React
67
- } ,
67
+ } ) ,
68
68
paramType : Diagnostics . KIND ,
69
69
description : Diagnostics . Specify_JSX_code_generation_Colon_preserve_or_react ,
70
70
} ,
@@ -91,24 +91,24 @@ namespace ts {
91
91
{
92
92
name : "module" ,
93
93
shortName : "m" ,
94
- type : {
94
+ type : createMap ( {
95
95
"none" : ModuleKind . None ,
96
96
"commonjs" : ModuleKind . CommonJS ,
97
97
"amd" : ModuleKind . AMD ,
98
98
"system" : ModuleKind . System ,
99
99
"umd" : ModuleKind . UMD ,
100
100
"es6" : ModuleKind . ES6 ,
101
101
"es2015" : ModuleKind . ES2015 ,
102
- } ,
102
+ } ) ,
103
103
description : Diagnostics . Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015 ,
104
104
paramType : Diagnostics . KIND ,
105
105
} ,
106
106
{
107
107
name : "newLine" ,
108
- type : {
108
+ type : createMap ( {
109
109
"crlf" : NewLineKind . CarriageReturnLineFeed ,
110
110
"lf" : NewLineKind . LineFeed
111
- } ,
111
+ } ) ,
112
112
description : Diagnostics . Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix ,
113
113
paramType : Diagnostics . NEWLINE ,
114
114
} ,
@@ -250,12 +250,12 @@ namespace ts {
250
250
{
251
251
name : "target" ,
252
252
shortName : "t" ,
253
- type : {
253
+ type : createMap ( {
254
254
"es3" : ScriptTarget . ES3 ,
255
255
"es5" : ScriptTarget . ES5 ,
256
256
"es6" : ScriptTarget . ES6 ,
257
257
"es2015" : ScriptTarget . ES2015 ,
258
- } ,
258
+ } ) ,
259
259
description : Diagnostics . Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015 ,
260
260
paramType : Diagnostics . VERSION ,
261
261
} ,
@@ -284,10 +284,10 @@ namespace ts {
284
284
} ,
285
285
{
286
286
name : "moduleResolution" ,
287
- type : {
287
+ type : createMap ( {
288
288
"node" : ModuleResolutionKind . NodeJs ,
289
289
"classic" : ModuleResolutionKind . Classic ,
290
- } ,
290
+ } ) ,
291
291
description : Diagnostics . Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6 ,
292
292
} ,
293
293
{
@@ -392,7 +392,7 @@ namespace ts {
392
392
type : "list" ,
393
393
element : {
394
394
name : "lib" ,
395
- type : {
395
+ type : createMap ( {
396
396
// JavaScript only
397
397
"es5" : "lib.es5.d.ts" ,
398
398
"es6" : "lib.es2015.d.ts" ,
@@ -417,7 +417,7 @@ namespace ts {
417
417
"es2016.array.include" : "lib.es2016.array.include.d.ts" ,
418
418
"es2017.object" : "lib.es2017.object.d.ts" ,
419
419
"es2017.sharedmemory" : "lib.es2017.sharedmemory.d.ts"
420
- } ,
420
+ } ) ,
421
421
} ,
422
422
description : Diagnostics . Specify_library_files_to_be_included_in_the_compilation_Colon
423
423
} ,
@@ -486,18 +486,17 @@ namespace ts {
486
486
/* @internal */
487
487
export function createCompilerDiagnosticForInvalidCustomType ( opt : CommandLineOptionOfCustomType ) : Diagnostic {
488
488
const namesOfType : string [ ] = [ ] ;
489
- forEachKey ( opt . type , key => {
489
+ for ( const key in opt . type ) {
490
490
namesOfType . push ( ` '${ key } '` ) ;
491
- } ) ;
492
-
491
+ }
493
492
return createCompilerDiagnostic ( Diagnostics . Argument_for_0_option_must_be_Colon_1 , `--${ opt . name } ` , namesOfType ) ;
494
493
}
495
494
496
495
/* @internal */
497
496
export function parseCustomTypeOption ( opt : CommandLineOptionOfCustomType , value : string , errors : Diagnostic [ ] ) {
498
497
const key = trimString ( ( value || "" ) ) . toLowerCase ( ) ;
499
498
const map = opt . type ;
500
- if ( hasProperty ( map , key ) ) {
499
+ if ( key in map ) {
501
500
return map [ key ] ;
502
501
}
503
502
else {
@@ -551,11 +550,11 @@ namespace ts {
551
550
s = s . slice ( s . charCodeAt ( 1 ) === CharacterCodes . minus ? 2 : 1 ) . toLowerCase ( ) ;
552
551
553
552
// Try to translate short option names to their full equivalents.
554
- if ( hasProperty ( shortOptionNames , s ) ) {
553
+ if ( s in shortOptionNames ) {
555
554
s = shortOptionNames [ s ] ;
556
555
}
557
556
558
- if ( hasProperty ( optionNameMap , s ) ) {
557
+ if ( s in optionNameMap ) {
559
558
const opt = optionNameMap [ s ] ;
560
559
561
560
if ( opt . isTSConfigOnly ) {
@@ -811,7 +810,7 @@ namespace ts {
811
810
const optionNameMap = arrayToMap ( optionDeclarations , opt => opt . name ) ;
812
811
813
812
for ( const id in jsonOptions ) {
814
- if ( hasProperty ( optionNameMap , id ) ) {
813
+ if ( id in optionNameMap ) {
815
814
const opt = optionNameMap [ id ] ;
816
815
defaultOptions [ opt . name ] = convertJsonOption ( opt , jsonOptions [ id ] , basePath , errors ) ;
817
816
}
@@ -848,7 +847,7 @@ namespace ts {
848
847
849
848
function convertJsonOptionOfCustomType ( opt : CommandLineOptionOfCustomType , value : string , errors : Diagnostic [ ] ) {
850
849
const key = value . toLowerCase ( ) ;
851
- if ( hasProperty ( opt . type , key ) ) {
850
+ if ( key in opt . type ) {
852
851
return opt . type [ key ] ;
853
852
}
854
853
else {
@@ -1011,7 +1010,7 @@ namespace ts {
1011
1010
removeWildcardFilesWithLowerPriorityExtension ( file , wildcardFileMap , supportedExtensions , keyMapper ) ;
1012
1011
1013
1012
const key = keyMapper ( file ) ;
1014
- if ( ! hasProperty ( literalFileMap , key ) && ! hasProperty ( wildcardFileMap , key ) ) {
1013
+ if ( ! ( key in literalFileMap ) && ! ( key in wildcardFileMap ) ) {
1015
1014
wildcardFileMap [ key ] = file ;
1016
1015
}
1017
1016
}
@@ -1076,7 +1075,7 @@ namespace ts {
1076
1075
if ( match ) {
1077
1076
const key = useCaseSensitiveFileNames ? match [ 0 ] : match [ 0 ] . toLowerCase ( ) ;
1078
1077
const flags = watchRecursivePattern . test ( name ) ? WatchDirectoryFlags . Recursive : WatchDirectoryFlags . None ;
1079
- const existingFlags = getProperty ( wildcardDirectories , key ) ;
1078
+ const existingFlags = wildcardDirectories [ key ] ;
1080
1079
if ( existingFlags === undefined || existingFlags < flags ) {
1081
1080
wildcardDirectories [ key ] = flags ;
1082
1081
if ( flags === WatchDirectoryFlags . Recursive ) {
@@ -1088,11 +1087,9 @@ namespace ts {
1088
1087
1089
1088
// Remove any subpaths under an existing recursively watched directory.
1090
1089
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 ] ;
1096
1093
}
1097
1094
}
1098
1095
}
@@ -1115,7 +1112,7 @@ namespace ts {
1115
1112
for ( let i = ExtensionPriority . Highest ; i < adjustedExtensionPriority ; i ++ ) {
1116
1113
const higherPriorityExtension = extensions [ i ] ;
1117
1114
const higherPriorityPath = keyMapper ( changeExtension ( file , higherPriorityExtension ) ) ;
1118
- if ( hasProperty ( literalFiles , higherPriorityPath ) || hasProperty ( wildcardFiles , higherPriorityPath ) ) {
1115
+ if ( higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles ) {
1119
1116
return true ;
1120
1117
}
1121
1118
}
0 commit comments