Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11638,8 +11638,11 @@ namespace ts {
if (propertiesArray.length > 0) {
spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true);
}
spread.flags |= propagatedFlags;
spread.symbol = node.symbol;
if (spread.flags & TypeFlags.Object) {
// only set the symbol and flags if this is a (fresh) object type
spread.flags |= propagatedFlags;
spread.symbol = node.symbol;
}
return spread;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//// [explicitAnyAfterSpreadNoImplicitAnyError.ts]
({ a: [], ...(null as any) });
let x: any;


//// [explicitAnyAfterSpreadNoImplicitAnyError.js]
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
(__assign({ a: [] }, null));
var x;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
=== tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts ===
({ a: [], ...(null as any) });
>a : Symbol(a, Decl(explicitAnyAfterSpreadNoImplicitAnyError.ts, 0, 2))

let x: any;
>x : Symbol(x, Decl(explicitAnyAfterSpreadNoImplicitAnyError.ts, 1, 3))

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
=== tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts ===
({ a: [], ...(null as any) });
>({ a: [], ...(null as any) }) : any
>{ a: [], ...(null as any) } : any
>a : undefined[]
>[] : undefined[]
>(null as any) : any
>null as any : any
>null : null

let x: any;
>x : any

1 change: 0 additions & 1 deletion tests/baselines/reference/objectSpread.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ let cplus: { p: number, plus(): void } = { ...c, plus() { return this.p + 1; } }
>plus : Symbol(plus, Decl(objectSpread.ts, 49, 23))
>c : Symbol(c, Decl(objectSpread.ts, 45, 3))
>plus : Symbol(plus, Decl(objectSpread.ts, 49, 48))
>this : Symbol(__object, Decl(objectSpread.ts, 41, 15))

cplus.plus();
>cplus.plus : Symbol(plus, Decl(objectSpread.ts, 49, 23))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// @noImplicitAny: true
({ a: [], ...(null as any) });
let x: any;