You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// d.ts inferencedeclareletb: {[x: number]: number;title: string;};declareletc: {[x: number]: number;// <--- this is missinglabel: string;title: string;};
It seems that when I add an extra property to the spread object, it loses the index signature properties from the spread source.
But, if I do not add any extra property it does infer correctly the type...
The text was updated successfully, but these errors were encountered:
Yes, I think you are right and it's a duplicate ... sorry I missed that
For context, this situation is slightly different as there is no overlap in the keys [x: number]: number and label: string, unlike the linked issue which uses Record<string, string> and a: '' where there is no obvious resolution.
I'm not sure if this is a relevant enough distinction to keep this issue open.
For reference, as mentioned in the comments there, Object.assign does produce an expected result
Bug Report
π Search Terms
typescript spread wrong type inference
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
π Expected behavior
It seems that when I add an extra property to the spread object, it loses the
index signature
properties from the spread source.But, if I do not add any extra property it does infer correctly the type...
The text was updated successfully, but these errors were encountered: