-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Incomplete typing for ngTooltip directive #3845
Labels
Comments
jnizet
added a commit
to jnizet/ng-bootstrap
that referenced
this issue
Sep 6, 2020
The documentation says that falsy values are accepted, but in strict mode, only the empty string could actually be passed. fix ng-bootstrap#3845
jnizet
added a commit
to jnizet/ng-bootstrap
that referenced
this issue
Sep 6, 2020
This makes it consistent with the behavior of tooltip. It also makes more sense since the title is an optional input, and its default value is thus undefined (which, in strict mode, is neither a string nor a TemplateRef). Note that a test checked that no title was displayed when the title was empty, but it actually checked that no title was displayed if the title was undefined. And it *did* display an empty title if the title was an empty string. Now, the title is displayed only is it is truthy. refs ng-bootstrap#3845
maxokorokov
pushed a commit
to jnizet/ng-bootstrap
that referenced
this issue
Nov 3, 2020
The documentation says that falsy values are accepted, but in strict mode, only the empty string could actually be passed. fix ng-bootstrap#3845
maxokorokov
pushed a commit
to jnizet/ng-bootstrap
that referenced
this issue
Nov 3, 2020
This makes it consistent with the behavior of tooltip. It also makes more sense since the title is an optional input, and its default value is thus undefined (which, in strict mode, is neither a string nor a TemplateRef). Note that a test checked that no title was displayed when the title was empty, but it actually checked that no title was displayed if the title was undefined. And it *did* display an empty title if the title was an empty string. Now, the title is displayed only is it is truthy. refs ng-bootstrap#3845
maxokorokov
pushed a commit
that referenced
this issue
Nov 3, 2020
This makes it consistent with the behavior of tooltip. It also makes more sense since the title is an optional input, and its default value is thus undefined (which, in strict mode, is neither a string nor a TemplateRef). Note that a test checked that no title was displayed when the title was empty, but it actually checked that no title was displayed if the title was undefined. And it *did* display an empty title if the title was an empty string. Now, the title is displayed only is it is truthy. refs #3845
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug description:
The input for the
ngTooltip
directive is defined asAs the comment notes, the input can be falsy, however, the only falsy value allowed by the types is the empty string. It would be nice if the typing also allod for
null
andundefined
. Running angular/typescript in strict mode makes it rather inconvenient to bind ngTooltip to a nullable property at the moment.Link to minimally-working StackBlitz that reproduces the issue:
https://stackblitz.com/edit/angular-jhnsp4-yzls3r?file=src/app/tooltip-basic.html
Versions of Angular, ng-bootstrap and Bootstrap:
Angular: 10.1
ng-bootstrap: 7.0.0
Bootstrap: 4.5.2
The text was updated successfully, but these errors were encountered: