-
Notifications
You must be signed in to change notification settings - Fork 1
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
Adding external validators to TextInput #4
Conversation
@@ -49,7 +46,7 @@ export default class EditText extends HTMLElement { | |||
|
|||
/** @param {InputValidator} validator */ | |||
addExternalValidator(validator) { |
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.
just "validator", it's not "external"
@@ -23,6 +23,9 @@ export default class TextInput extends HTMLElement { | |||
}; | |||
/** @type {string} */ | |||
#lastChangedValue; | |||
// @ts-ignore |
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.
Why ignore?
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.
Because in another case, we need to make an unused import of this component. And if we don’t do this, we get an error
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.
I don't understand. What kind of error?
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.
TS2304: Cannot find name 'InputValidator'
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.
Ok, you need to put this explanation whenever you add some "ignore".
So the problem is that JS Doc doesn't know what type we're referencing without an import - it doesn't know where this type is coming from. But there seems to be a solution to this problem: https://stackoverflow.com/questions/51982814/reference-definition-from-ts-check-js-file
@@ -23,6 +23,9 @@ export default class TextInput extends HTMLElement { | |||
}; | |||
/** @type {string} */ | |||
#lastChangedValue; | |||
// @ts-ignore | |||
/** @type {InputValidator} */ |
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.
Should be an array
No description provided.