-
Notifications
You must be signed in to change notification settings - Fork 110
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
Added undefined as required #65
Conversation
Thank you for this PR. Please rebase your change onto |
Updated and rebased! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the issues I pointed out in my comments.
validation/src/required.ts
Outdated
@@ -1,7 +1,7 @@ | |||
import { ValidationErrors } from 'ngrx-forms'; | |||
|
|||
/** | |||
* A validation function that requires the value to be non-`null` and non-empty. | |||
* A validation function that requires the value to be non-`undefined` and non-empty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please mention both null
and undefined
, i.e. "A validation function that requires the value to be non-null
, non-undefined
, and non-empty."
validation/src/required.ts
Outdated
@@ -23,7 +23,7 @@ import { ValidationErrors } from 'ngrx-forms'; | |||
* ``` | |||
*/ | |||
export function required<T>(value: T | null): ValidationErrors { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To support strict type checking you need to make it explicit that the function accepts undefined
as a value, i.e.
export function required<T>(value: T | null | undefined): ValidationErrors {
This will also fix the TSLint error.
Thanks for the update. As you can see here there is a TSLint error. Have a look at my inline comments for what needs to be changed. |
Thanks for the review, I updated as requested. |
Related to this issue: Error FromGroupState property undefined with validation required #64