-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
TypeScript Version: 3.9.0-dev.20200328
Search Terms:
property-will-be-overwritten-by-spread
Code
type A = {
a?: any
}
const a: A = {};
const b = { a: 'zzz', ...a, }; // 'a' is specified more than once, so this usage will be overwrittenUsing string instead of any as the type of a property in A works as expected.
Expected behavior:
No error
Actual behavior:
'a' is specified more than once, so this usage will be overwritten.(2783)
input.ts(6, 24): This spread always overwrites this property.
Playground Link:
Using any errors - bug
Using string no error - works as expected
Related Issues: #36779
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue