-
Notifications
You must be signed in to change notification settings - Fork 158
docs: add type assert for text validation example #389
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
docs: add type assert for text validation example #389
Conversation
|
|
@example/basic • @example/changesets commit: |
|
the so it is possible that we should be doing something like: if (!value || !value.test(regex)) {
// error
} |
Thanks for your reply. The example has an |
|
it does have an initial value so it means in this particular case, it can't be but as far as typescript is concerned, it can still be the types are currently right even though you've managed to make runtime code that never sets it as |
e5527f8 to
87cf493
Compare
I get it. Initially, I added a non-null check. But after testing, I am confused that it should be |

The type of
valueshould bestring, maybe we can add type assert to pass this type check.