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
Have validate accept null and undefined #606
Comments
Thanks for the report. This is actually a (I'm actually surprised nobody has complained about this yet.) > require('uuid').validate(null)
false
> require('uuid').validate(undefined)
false @grosch: We'll fix this up on our end, but this taps into a bigger debate we've been having about whether we should provide TS types natively as pat of this project. In the meantime, I suggest just casting the argument to a string, ala @ctavan Looks like the |
I think it could make sense to fix that on |
@grosch feel free to propose a pull request with a fix to https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/uuid/index.d.ts I'll be more than happy to help get this merged quickly over there. |
If you are sending a PR, I would recommend to change it to from |
@LinusU Can you provide a link to the typescript docs that discuss whatever that behavior is that you're describing? I'm still learning TS and this sort of conditional typing sounds interesting. |
https://www.typescripttutorial.net/typescript-tutorial/typescript-type-guards/ |
Marking as stale due to 90 days with no activity. |
Closing issue due to 30 days since being marked as stale. |
Reopening as this may be solved in #654. |
Marking as stale due to 90 days with no activity. |
Closing issue due to 30 days since being marked as stale. |
Just to make life easier, it would be great if when I call
uuidValidate
and pass innull
orundefined
, it returned false. Right now the compiler doesn't allow a potentially null/undefined value to be given.Right now I'm doing something like this:
The text was updated successfully, but these errors were encountered: