🔎 Search Terms
keyof required keys key evaluation reduce getReducedType
🕗 Version & Regression Information
- This is the behavior in every version I tried
⏯ Playground Link
https://tsplay.dev/WKQkzN
💻 Code
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
🔎 Search Terms
keyof required keys key evaluation reduce getReducedType
🕗 Version & Regression Information
⏯ Playground Link
https://tsplay.dev/WKQkzN
💻 Code
🙁 Actual behavior
requiredDistilledKeyinferred asunknown🙂 Expected behavior
requiredDistilledKeyinferred asnever, consistent with the equivalent declared versionAdditional information about the issue
No response