Skip to content

Commit 97bba40

Browse files
committed
Fixup baselines
1 parent 0db52ec commit 97bba40

10 files changed

+21
-98
lines changed

src/compiler/checker.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15510,12 +15510,15 @@ namespace ts {
1551015510
* Should all count as literals and not print errors on access or assignment of possibly existing properties.
1551115511
* This mirrors the behavior of the index signature propagation, to which this behaves similarly (but doesn't affect assignability or inference).
1551215512
*/
15513-
function isJSLiteralType(type: Type): boolean {
15513+
function isJSLiteralType(type: Type, context?: Node): boolean {
15514+
if (noImplicitAny(getSourceFileOfNode(context))) {
15515+
return false; // Flag is meaningless under `noImplicitAny` mode
15516+
}
1551415517
if (getObjectFlags(type) & ObjectFlags.JSLiteral) {
1551515518
return true;
1551615519
}
1551715520
if (type.flags & TypeFlags.Union) {
15518-
return every((type as UnionType).types, isJSLiteralType);
15521+
return every((type as UnionType).types, t => isJSLiteralType(t));
1551915522
}
1552015523
if (type.flags & TypeFlags.Intersection) {
1552115524
return some((type as IntersectionType).types, isJSLiteralType);
@@ -15622,7 +15625,7 @@ namespace ts {
1562215625
if (indexType.flags & TypeFlags.Never) {
1562315626
return neverType;
1562415627
}
15625-
if (isJSLiteralType(objectType)) {
15628+
if (isJSLiteralType(objectType, accessNode)) {
1562615629
return anyType;
1562715630
}
1562815631
if (accessExpression && !isConstEnumObjectType(objectType)) {
@@ -15693,7 +15696,7 @@ namespace ts {
1569315696
return undefined;
1569415697
}
1569515698
}
15696-
if (isJSLiteralType(objectType)) {
15699+
if (isJSLiteralType(objectType, accessNode)) {
1569715700
return anyType;
1569815701
}
1569915702
if (accessNode) {
@@ -29231,7 +29234,7 @@ namespace ts {
2923129234
getApplicableIndexInfoForName(apparentType, right.escapedText) : undefined;
2923229235
if (!(indexInfo && indexInfo.type)) {
2923329236
const isUncheckedJS = isUncheckedJSSuggestion(node, leftType.symbol, /*excludeClasses*/ true);
29234-
if (!isUncheckedJS && isJSLiteralType(leftType)) {
29237+
if (!isUncheckedJS && isJSLiteralType(leftType, node)) {
2923529238
return anyType;
2923629239
}
2923729240
if (leftType.symbol === globalThisSymbol) {

src/compiler/commandLineParser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,7 @@ namespace ts {
13871387
...commandOptionsWithoutBuild,
13881388
] as const);
13891389

1390+
/* @internal */
13901391
type WithTrue<T, K extends keyof T> = T extends unknown ? K extends unknown ? T[K] extends true ? T : never : never : never;
13911392

13921393
function isAffectsSemanticDiagnosticsOption<T extends CommandLineOption>(option: T): option is WithTrue<T, "affectsSemanticDiagnostics"> {

tests/baselines/reference/booleanLiteralsContextuallyTypedFromUnion.errors.txt

Lines changed: 0 additions & 31 deletions
This file was deleted.

tests/baselines/reference/jsxSpreadOverwritesAttributeStrict.errors.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
error TS2318: Cannot find global type 'CallableFunction'.
21
error TS2318: Cannot find global type 'NewableFunction'.
32
tests/cases/conformance/jsx/file.tsx(19,17): error TS2783: 'a' is specified more than once, so this usage will be overwritten.
43
tests/cases/conformance/jsx/file.tsx(20,17): error TS2783: 'a' is specified more than once, so this usage will be overwritten.
@@ -10,7 +9,6 @@ tests/cases/conformance/jsx/file.tsx(22,17): error TS2783: 'a' is specified more
109
tests/cases/conformance/jsx/file.tsx(22,23): error TS2783: 'd' is specified more than once, so this usage will be overwritten.
1110

1211

13-
!!! error TS2318: Cannot find global type 'CallableFunction'.
1412
!!! error TS2318: Cannot find global type 'NewableFunction'.
1513
==== tests/cases/conformance/jsx/file.tsx (8 errors) ====
1614
import React = require('react');

tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,10 @@ Output::
134134

135135
error TS2318: Cannot find global type 'Boolean'.
136136

137-
error TS2318: Cannot find global type 'CallableFunction'.
138-
139137
error TS2318: Cannot find global type 'Function'.
140138

141139
error TS2318: Cannot find global type 'IArguments'.
142140

143-
error TS2318: Cannot find global type 'NewableFunction'.
144-
145141
error TS2318: Cannot find global type 'Number'.
146142

147143
error TS2318: Cannot find global type 'Object'.
@@ -159,7 +155,7 @@ Output::
159155
   ~~~~~~~~
160156
File is default library for target specified here.
161157

162-
[[90m12:00:40 AM[0m] Found 11 errors. Watching for file changes.
158+
[[90m12:00:40 AM[0m] Found 9 errors. Watching for file changes.
163159

164160

165161

@@ -269,14 +265,10 @@ Output::
269265

270266
error TS2318: Cannot find global type 'Boolean'.
271267

272-
error TS2318: Cannot find global type 'CallableFunction'.
273-
274268
error TS2318: Cannot find global type 'Function'.
275269

276270
error TS2318: Cannot find global type 'IArguments'.
277271

278-
error TS2318: Cannot find global type 'NewableFunction'.
279-
280272
error TS2318: Cannot find global type 'Number'.
281273

282274
error TS2318: Cannot find global type 'Object'.
@@ -294,7 +286,7 @@ Output::
294286
   ~~~~~~~~
295287
File is default library for target specified here.
296288

297-
[[90m12:00:48 AM[0m] Found 11 errors. Watching for file changes.
289+
[[90m12:00:48 AM[0m] Found 9 errors. Watching for file changes.
298290

299291

300292

tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,10 @@ Output::
134134

135135
error TS2318: Cannot find global type 'Boolean'.
136136

137-
error TS2318: Cannot find global type 'CallableFunction'.
138-
139137
error TS2318: Cannot find global type 'Function'.
140138

141139
error TS2318: Cannot find global type 'IArguments'.
142140

143-
error TS2318: Cannot find global type 'NewableFunction'.
144-
145141
error TS2318: Cannot find global type 'Number'.
146142

147143
error TS2318: Cannot find global type 'Object'.
@@ -159,7 +155,7 @@ Output::
159155
   ~~~~~~~~
160156
File is default library for target specified here.
161157

162-
[[90m12:00:46 AM[0m] Found 11 errors. Watching for file changes.
158+
[[90m12:00:46 AM[0m] Found 9 errors. Watching for file changes.
163159

164160

165161

@@ -269,14 +265,10 @@ Output::
269265

270266
error TS2318: Cannot find global type 'Boolean'.
271267

272-
error TS2318: Cannot find global type 'CallableFunction'.
273-
274268
error TS2318: Cannot find global type 'Function'.
275269

276270
error TS2318: Cannot find global type 'IArguments'.
277271

278-
error TS2318: Cannot find global type 'NewableFunction'.
279-
280272
error TS2318: Cannot find global type 'Number'.
281273

282274
error TS2318: Cannot find global type 'Object'.
@@ -294,7 +286,7 @@ Output::
294286
   ~~~~~~~~
295287
File is default library for target specified here.
296288

297-
[[90m12:00:54 AM[0m] Found 11 errors. Watching for file changes.
289+
[[90m12:00:54 AM[0m] Found 9 errors. Watching for file changes.
298290

299291

300292

tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,10 @@ Output::
134134

135135
error TS2318: Cannot find global type 'Boolean'.
136136

137-
error TS2318: Cannot find global type 'CallableFunction'.
138-
139137
error TS2318: Cannot find global type 'Function'.
140138

141139
error TS2318: Cannot find global type 'IArguments'.
142140

143-
error TS2318: Cannot find global type 'NewableFunction'.
144-
145141
error TS2318: Cannot find global type 'Number'.
146142

147143
error TS2318: Cannot find global type 'Object'.
@@ -159,7 +155,7 @@ Output::
159155
   ~~~~~~~~
160156
File is default library for target specified here.
161157

162-
[[90m12:00:36 AM[0m] Found 11 errors. Watching for file changes.
158+
[[90m12:00:36 AM[0m] Found 9 errors. Watching for file changes.
163159

164160

165161

@@ -261,14 +257,10 @@ Output::
261257

262258
error TS2318: Cannot find global type 'Boolean'.
263259

264-
error TS2318: Cannot find global type 'CallableFunction'.
265-
266260
error TS2318: Cannot find global type 'Function'.
267261

268262
error TS2318: Cannot find global type 'IArguments'.
269263

270-
error TS2318: Cannot find global type 'NewableFunction'.
271-
272264
error TS2318: Cannot find global type 'Number'.
273265

274266
error TS2318: Cannot find global type 'Object'.
@@ -286,7 +278,7 @@ Output::
286278
   ~~~~~~~~
287279
File is default library for target specified here.
288280

289-
[[90m12:00:42 AM[0m] Found 11 errors. Watching for file changes.
281+
[[90m12:00:42 AM[0m] Found 9 errors. Watching for file changes.
290282

291283

292284

tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,10 @@ Output::
134134

135135
error TS2318: Cannot find global type 'Boolean'.
136136

137-
error TS2318: Cannot find global type 'CallableFunction'.
138-
139137
error TS2318: Cannot find global type 'Function'.
140138

141139
error TS2318: Cannot find global type 'IArguments'.
142140

143-
error TS2318: Cannot find global type 'NewableFunction'.
144-
145141
error TS2318: Cannot find global type 'Number'.
146142

147143
error TS2318: Cannot find global type 'Object'.
@@ -159,7 +155,7 @@ Output::
159155
   ~~~~~~~~
160156
File is default library for target specified here.
161157

162-
[[90m12:00:31 AM[0m] Found 11 errors. Watching for file changes.
158+
[[90m12:00:31 AM[0m] Found 9 errors. Watching for file changes.
163159

164160

165161

@@ -256,14 +252,10 @@ Output::
256252

257253
error TS2318: Cannot find global type 'Boolean'.
258254

259-
error TS2318: Cannot find global type 'CallableFunction'.
260-
261255
error TS2318: Cannot find global type 'Function'.
262256

263257
error TS2318: Cannot find global type 'IArguments'.
264258

265-
error TS2318: Cannot find global type 'NewableFunction'.
266-
267259
error TS2318: Cannot find global type 'Number'.
268260

269261
error TS2318: Cannot find global type 'Object'.
@@ -281,7 +273,7 @@ Output::
281273
   ~~~~~~~~
282274
File is default library for target specified here.
283275

284-
[[90m12:00:38 AM[0m] Found 11 errors. Watching for file changes.
276+
[[90m12:00:38 AM[0m] Found 9 errors. Watching for file changes.
285277

286278

287279

tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,10 @@ Output::
134134

135135
error TS2318: Cannot find global type 'Boolean'.
136136

137-
error TS2318: Cannot find global type 'CallableFunction'.
138-
139137
error TS2318: Cannot find global type 'Function'.
140138

141139
error TS2318: Cannot find global type 'IArguments'.
142140

143-
error TS2318: Cannot find global type 'NewableFunction'.
144-
145141
error TS2318: Cannot find global type 'Number'.
146142

147143
error TS2318: Cannot find global type 'Object'.
@@ -159,7 +155,7 @@ Output::
159155
   ~~~~~~~~
160156
File is default library for target specified here.
161157

162-
[[90m12:00:34 AM[0m] Found 11 errors. Watching for file changes.
158+
[[90m12:00:34 AM[0m] Found 9 errors. Watching for file changes.
163159

164160

165161

@@ -269,14 +265,10 @@ Output::
269265

270266
error TS2318: Cannot find global type 'Boolean'.
271267

272-
error TS2318: Cannot find global type 'CallableFunction'.
273-
274268
error TS2318: Cannot find global type 'Function'.
275269

276270
error TS2318: Cannot find global type 'IArguments'.
277271

278-
error TS2318: Cannot find global type 'NewableFunction'.
279-
280272
error TS2318: Cannot find global type 'Number'.
281273

282274
error TS2318: Cannot find global type 'Object'.
@@ -294,7 +286,7 @@ Output::
294286
   ~~~~~~~~
295287
File is default library for target specified here.
296288

297-
[[90m12:00:42 AM[0m] Found 11 errors. Watching for file changes.
289+
[[90m12:00:42 AM[0m] Found 9 errors. Watching for file changes.
298290

299291

300292

tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,10 @@ Output::
134134

135135
error TS2318: Cannot find global type 'Boolean'.
136136

137-
error TS2318: Cannot find global type 'CallableFunction'.
138-
139137
error TS2318: Cannot find global type 'Function'.
140138

141139
error TS2318: Cannot find global type 'IArguments'.
142140

143-
error TS2318: Cannot find global type 'NewableFunction'.
144-
145141
error TS2318: Cannot find global type 'Number'.
146142

147143
error TS2318: Cannot find global type 'Object'.
@@ -159,7 +155,7 @@ Output::
159155
   ~~~~~~~~
160156
File is default library for target specified here.
161157

162-
[[90m12:00:30 AM[0m] Found 11 errors. Watching for file changes.
158+
[[90m12:00:30 AM[0m] Found 9 errors. Watching for file changes.
163159

164160

165161

@@ -261,14 +257,10 @@ Output::
261257

262258
error TS2318: Cannot find global type 'Boolean'.
263259

264-
error TS2318: Cannot find global type 'CallableFunction'.
265-
266260
error TS2318: Cannot find global type 'Function'.
267261

268262
error TS2318: Cannot find global type 'IArguments'.
269263

270-
error TS2318: Cannot find global type 'NewableFunction'.
271-
272264
error TS2318: Cannot find global type 'Number'.
273265

274266
error TS2318: Cannot find global type 'Object'.
@@ -286,7 +278,7 @@ Output::
286278
   ~~~~~~~~
287279
File is default library for target specified here.
288280

289-
[[90m12:00:36 AM[0m] Found 11 errors. Watching for file changes.
281+
[[90m12:00:36 AM[0m] Found 9 errors. Watching for file changes.
290282

291283

292284

0 commit comments

Comments
 (0)