Skip to content

Commit

Permalink
Allow null and undefined values for [matTooltip] explicitly.
Browse files Browse the repository at this point in the history
We have tests that already set these values (but used to use nullness assertions to overcome the build failures) and protect against it by treating these values as empty strings (and thus we hide the tooltip), but we don't allow anyone who uses templates with strict type checking to set optional values unless they add their own nullness assertion.
  • Loading branch information
Eyas authored Jul 8, 2024
1 parent 5898911 commit f6b6488
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/material/tooltip/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ export class MatTooltip implements OnDestroy, AfterViewInit {
return this._message;
}

set message(value: string) {
set message(value: string | null | undefined) {
this._ariaDescriber.removeDescription(this._elementRef.nativeElement, this._message, 'tooltip');

// If the message is not a string (e.g. number), convert it to a string and trim it.
Expand Down

0 comments on commit f6b6488

Please sign in to comment.