@@ -102,16 +102,33 @@ namespace ts {
102
102
]
103
103
} ) ;
104
104
105
+ showTSConfigCorrectly ( "Show TSConfig with watch options" , [ "-p" , "tsconfig.json" ] , {
106
+ watchOptions : {
107
+ watchFile : "DynamicPriorityPolling"
108
+ } ,
109
+ include : [
110
+ "./src/**/*"
111
+ ]
112
+ } ) ;
113
+
105
114
// Bulk validation of all option declarations
106
115
for ( const option of optionDeclarations ) {
107
- if ( option . name === "project" ) continue ;
108
- let configObject : object | undefined ;
116
+ baselineOption ( option , /*isCompilerOptions*/ true ) ;
117
+ }
118
+
119
+ for ( const option of optionsForWatch ) {
120
+ baselineOption ( option , /*isCompilerOptions*/ false ) ;
121
+ }
122
+
123
+ function baselineOption ( option : CommandLineOption , isCompilerOptions : boolean ) {
124
+ if ( option . name === "project" ) return ;
109
125
let args : string [ ] ;
126
+ let optionValue : object | undefined ;
110
127
switch ( option . type ) {
111
128
case "boolean" : {
112
129
if ( option . isTSConfigOnly ) {
113
130
args = [ "-p" , "tsconfig.json" ] ;
114
- configObject = { compilerOptions : { [ option . name ] : true } } ;
131
+ optionValue = { [ option . name ] : true } ;
115
132
}
116
133
else {
117
134
args = [ `--${ option . name } ` ] ;
@@ -121,7 +138,7 @@ namespace ts {
121
138
case "list" : {
122
139
if ( option . isTSConfigOnly ) {
123
140
args = [ "-p" , "tsconfig.json" ] ;
124
- configObject = { compilerOptions : { [ option . name ] : [ ] } } ;
141
+ optionValue = { [ option . name ] : [ ] } ;
125
142
}
126
143
else {
127
144
args = [ `--${ option . name } ` ] ;
@@ -131,7 +148,7 @@ namespace ts {
131
148
case "string" : {
132
149
if ( option . isTSConfigOnly ) {
133
150
args = [ "-p" , "tsconfig.json" ] ;
134
- configObject = { compilerOptions : { [ option . name ] : "someString" } } ;
151
+ optionValue = { [ option . name ] : "someString" } ;
135
152
}
136
153
else {
137
154
args = [ `--${ option . name } ` , "someString" ] ;
@@ -141,7 +158,7 @@ namespace ts {
141
158
case "number" : {
142
159
if ( option . isTSConfigOnly ) {
143
160
args = [ "-p" , "tsconfig.json" ] ;
144
- configObject = { compilerOptions : { [ option . name ] : 0 } } ;
161
+ optionValue = { [ option . name ] : 0 } ;
145
162
}
146
163
else {
147
164
args = [ `--${ option . name } ` , "0" ] ;
@@ -150,7 +167,7 @@ namespace ts {
150
167
}
151
168
case "object" : {
152
169
args = [ "-p" , "tsconfig.json" ] ;
153
- configObject = { compilerOptions : { [ option . name ] : { } } } ;
170
+ optionValue = { [ option . name ] : { } } ;
154
171
break ;
155
172
}
156
173
default : {
@@ -159,14 +176,17 @@ namespace ts {
159
176
const val = iterResult . value ;
160
177
if ( option . isTSConfigOnly ) {
161
178
args = [ "-p" , "tsconfig.json" ] ;
162
- configObject = { compilerOptions : { [ option . name ] : val } } ;
179
+ optionValue = { [ option . name ] : val } ;
163
180
}
164
181
else {
165
182
args = [ `--${ option . name } ` , val ] ;
166
183
}
167
184
break ;
168
185
}
169
186
}
187
+
188
+ const configObject = optionValue &&
189
+ ( isCompilerOptions ? { compilerOptions : optionValue } : { watchOptions : optionValue } ) ;
170
190
showTSConfigCorrectly ( `Shows tsconfig for single option/${ option . name } ` , args , configObject ) ;
171
191
}
172
192
} ) ;
0 commit comments