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

Optional boolean prop gives type Ref<boolean | undefined> which should be Ref<boolean> in vue #2219

Closed
jd-solanki opened this issue Dec 17, 2022 · 2 comments
Labels

Comments

@jmroon
Copy link

jmroon commented Jan 7, 2023

This is correct behavior if you have strictNullChecks on in typescript. Any optional property should be type | undefined.

The whole point of having strict on and having the property as optional is that you need to explicitly handle cases where it may be undefined. However, in the case of a boolean there's really no impact, since undefined is a falsy value anyways.

My guess is the SFC playground doesn't have strict mode on.

@xiaoxiangmoe
Copy link
Collaborator

Type definition for defineProps is in https://github.com/vuejs/core/blob/1fa3d9573051f549e6d381a5e88ec8d5d855e4c9/packages/runtime-core/src/apiSetupHelpers.ts#L61

Please create an issue in vuejs/core

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants