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
{{ message }}
Repository navigation
Multiple keys being remapped to same key causes unstable modifier propagation #62318
This has been happening since first release of key remapping at 4.1 (tested with v4.1.5 at Playground) until nightly (tested with v6.0.0-dev.20250822 at Playground).
I agree that you want the output not to depend on the order of properties in the input, since order of properties is supposed to be unobservable.
But I don't see why you expect the property to be required. When you collapse multiple input properties to a single property with key remapping you get the union of the property types, e.g:
typeCollapse<T>={[KinkeyofTas"x"]: T[K]}typeX=Collapse<{a: string,b: number,c: boolean}>// ^? type X = { x: string | number | boolean; }
So I'd expect to see the sort of thing you get when you combine unions of optional-and-required, which is effectively optional (you can think of | undefined as being sort of optional, and so if any one of the inputs is optional and included | undefined, the output should also).
By the way, the selection would be a sort of design decision, so my (stronger) expectation is that TypeScript team decide whether it should or should not be optional.
Activity
jcalz commentedon Aug 23, 2025
I agree that you want the output not to depend on the order of properties in the input, since order of properties is supposed to be unobservable.
But I don't see why you expect the property to be required. When you collapse multiple input properties to a single property with key remapping you get the union of the property types, e.g:
Playground link
So I'd expect to see the sort of thing you get when you combine unions of optional-and-required, which is effectively optional (you can think of
| undefinedas being sort of optional, and so if any one of the inputs is optional and included| undefined, the output should also).cm-ayf commentedon Aug 23, 2025
Joe Calzaretta (@jcalz) Thank you for the comment! I've changed the description.
By the way, the selection would be a sort of design decision, so my (stronger) expectation is that TypeScript team decide whether it should or should not be optional.
RyanCavanaugh commentedon Aug 29, 2025
Discussed at design meeting:
readonlyFixed mapped type modifier propagation when remapping multiple keys t…