-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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): RequiredKeys should include Prop<T, D> #2483
Conversation
Can you add a test case for that? |
Another way to test it is type NoNullableFields<T> = { [P in keyof T]-?: NonNullable<T[P]> }
type Expected = { foo: boolean }
type Result = ExtractPropTypes<NoNullableFields<ComponentObjectPropsOptions<Expected>>>
expectType<{ foo: boolean }>({} as Result) Basically making it possible to convert between |
@KaelWD Hey, can you fix the conflict? |
Done. |
@KaelWD if you use const props: { foo: Prop<boolean> } = { foo: { type: Boolean } } |
Not sure what you mean by that, |
i mean if you use object literal to make ts infer the type, then vue will know that if you have a default field in the PropOption. use sorry, boolean is not proper here, you can use |
I have a factory function for props that uses
Prop<T, D>
, but when used in a component the props always includeundefined
even ifD
is set. Not entirely sure how to test this, but it works with vuetifyjs/vuetify#12510 when replaced in node_modules.Example code: