-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
useId return type is potentially undefined #11897
Comments
that's right, it should be core/packages/runtime-core/src/helpers/useId.ts Lines 7 to 17 in d0b513e
|
Does anyone else finds it annoying to always cast it to string? const id = useId() as string; |
I have also encountered this issue today. It's new to me that the return type of There is also some discussion about this here: #11404 I'm not sure how to handle an Thanks! |
const id = useId()! |
After thinking about this, we do already have other helpers like |
Vue version
3.5.4
Link to minimal reproduction
https://play.vuejs.org/#eNp9kEFLAzEQhf9KyKUKZT2ol9oKKj3Ug4p6DMiSna6p2SQkk3VhyX93kqW1gvSybN73MvPyRn7nXNVH4Au+DNIrhywARsd0bdqV4BgEvxVGdc56ZCOLATYNS2zrbcdmdHEmjDDSmoAMgT6ryXJ2fiPM8mIaSQPogNA5XSPQibFxzO6UsukI8DltpGlb1Va7YA3FGrNdcGk7pzT4Z4eKtgm+YIVkVmttvx+Lhj7CfK/LT5Bf/+i7MGRN8BcPAXwPgh8Y1r4FnPD67QkG+j/AzjZRk/sEfIVgdcwZJ9t9NA3FPvKVtJtSqDLte1gPCCbsH/UnaECvZAmT5aymwgSn5h9ONPL7isvqutwTJlG5Hz34vIp6JVBd8fQDoa+puA==
Steps to reproduce
Hover over
id
to see the typeWhat is expected?
Return type is
string
What is actually happening?
Return type is
string | undefined
System Info
No response
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: