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
typeMyType<G>=[G]extends[object] ? G : G;functionf<G>(x: keyofG): MyType<keyofG>{returnx;}
I expect keyof G to be assianble to MyType<keyof G> as MyType is basically an identity type.
Should I create a new issue and close this one or edit this issue accordingly?
This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. If you're still waiting on a response, questions are usually better suited to stackoverflow or the TypeScript Discord community.
EDIT: I wrote this completely wrong, please see comments
Bug Report
🔎 Search Terms
Issue with keyof passed to a generic with conditional types (Sorry can't think of a better description)
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
or:
🙁 Actual behavior
Fails with the following error:
🙂 Expected behavior
G should be assignable to [G] extends [object] ? G : G.
Additional clues
Without condition it works
With condition that is always true it works:
With a condition that is always false it doesn't work:
The text was updated successfully, but these errors were encountered: