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
typedistilled=distill<{// ^?foo: "default"bar?: number}>// incorrectly inferred as unknowntyperequiredDistilledKey=requiredKeyOf<distilled>// ^?// explicit declaration identical to hover of distilledtypedeclared={bar?: number}&{foo?: "default"}// now correctly inferred as nevertyperequiredDeclaredKey=requiredKeyOf<declared>// ^?typerequiredKeyOf<o>={[kinkeyofo]-?: oextends{[_ink]-?: o[k]} ? k : never}[keyofo]typedistill<t>=textendsobject ? distillMappable<t> : ttypedistillMappable<o>={[kinkeyofoaskextendsinferredDefaultKeyOf<o> ? never : k]: distill<o[k]>}&{[kininferredDefaultKeyOf<o>]?: distill<o[k]>}typeinferredDefaultKeyOf<o>={[kinkeyofo]: o[k]extends"default" ? k : never}[keyofo]
π Actual behavior
requiredDistilledKey inferred as unknown
π Expected behavior
requiredDistilledKey inferred as never, consistent with the equivalent declared version
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered:
ssalbdivad
changed the title
Keys of computed type inferred inconsistently with the same type when explicitly declared
Computed type key inference inconsistent with identical explicitly declared type
Sep 17, 2024
Duplicate of #59948. Without exactOptionalPropertyTypes the added | undefined makes no difference, and with exactOptionalPropertyTypes enabled the types are identical.
It's not a duplicate of that other issue, the other one is purely about how types are displayed. This one here is an actual functional difference between those 2, seemingly, identical types.
π Search Terms
keyof required keys key evaluation reduce getReducedType
π Version & Regression Information
β― Playground Link
https://tsplay.dev/WKQkzN
π» Code
π Actual behavior
requiredDistilledKey
inferred asunknown
π Expected behavior
requiredDistilledKey
inferred asnever
, consistent with the equivalent declared versionAdditional information about the issue
No response
The text was updated successfully, but these errors were encountered: