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
Duplicate of #31445 (the repro there looks a little different, but the explanation works perfectly, and many of the other issues linked to that one look more similar to this)
π Search Terms
mapped types, union, union types, extract, narrow
π Version & Regression Information
This is the behavior in every version I tried, and I reviewed the FAQ for entries about mapped type
β― Playground Link
https://www.typescriptlang.org/play?ts=5.3.0-dev.20230903#code/JYOwLgpgTgZghgYwgAgPICMBWBGZBvAKGWQGsIBPALmQHJsaBuI5EOAWwmoGcwpQBzJgF8CoSLEQoMmAEz5mZKrRmNm7APYBXcNRCa26aMIJhyABylYICMF2QBeNFlwAfJ7KYnzlzNbABZODMAFW8HeWIAbQBpClCLZFB3Py5ImkUaAF1MgH5qAFEAD15EMAAeaRSAGnxSCmpY8niUIQA+YU8EdRAeZHUrG0CzakrBoObwwmJsainiOqU6GirmYlYOahp1iGXmIRWhJhhtG2Bu5DgAE0vRsGD1IYqsZAhiiBBLu1uuVoAKfswIywAEoIn0BgEgpEAQA6RSZcIA4RAA
π» Code
π Actual behavior
The object map does not accept a new entry unless it is specifically typed as
Obj1
orObj2
, therefore more broadly typedObjects
are not accepted.π Expected behavior
Since the
ObjectMapType
uses a mapped type forObjects
, all of its variations are included, so everything that is typed asObjects
should be accepted.Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: