-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(types): inference for generic object types #9418
Conversation
Size ReportBundles
Usages
|
: [T] extends [{ type: infer U; default: infer D }] | ||
? [T] extends [PropOptions<infer V, infer E>] | ||
? V | ||
: D | ||
: [T] extends [{ type: infer U }] | ||
? [T] extends [PropOptions<infer V>] | ||
? V | ||
: U | ||
: [T] extends [{ default: infer U }] | ||
? [T] extends [PropOptions<infer V, infer D>] | ||
? D | ||
: U | ||
: [T] extends [PropType<infer V>] | ||
? V |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a few infers not being used can you remove any infers that are not being used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, will do
Closing because #9652 has a better solution. #9652 (review) is going to be hard though. |
This one fixes
Possibly related:
props
language-tools#2192 (comment)props
#8144I've used this rather verbose notation because TypeScript doesn't let us assume anything (unknown extends T etc.) about the generic type
T
. Not sure if it's the best way to work around this limitation - let me know if you have a better idea.