Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

davidmatter
Copy link
Contributor

This one fixes

Possibly related:

I'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.

@sxzz sxzz requested a review from pikax October 19, 2023 17:24
@github-actions
Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 85.9 kB 32.6 kB 29.5 kB
vue.global.prod.js 132 kB 49.3 kB 44.4 kB

Usages

Name Size Gzip Brotli
createApp 47.9 kB 18.8 kB 17.2 kB
createSSRApp 50.6 kB 19.9 kB 18.2 kB
defineCustomElement 50.3 kB 19.6 kB 17.9 kB
overall 61.2 kB 23.7 kB 21.6 kB

Comment on lines +124 to +137
: [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
Copy link
Member

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?

Copy link
Contributor Author

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

@davidmatter
Copy link
Contributor Author

Closing because #9652 has a better solution. #9652 (review) is going to be hard though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Rejected
Development

Successfully merging this pull request may close these issues.

3 participants