Skip to content

Commit

Permalink
refactor(core): remove truthy check for classes getter (#44087)
Browse files Browse the repository at this point in the history
Remove the truthy check for the classes getter as both paths from the check assume className was not
undefined.  This allows for typescript to properly determine the type of `className` in the falsy path
from the truthy check.

PR Close #44087
  • Loading branch information
josephperrott authored and atscott committed Nov 5, 2021
1 parent 210f7e5 commit c96ba23
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/debug/debug_node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,8 @@ class DebugElement__POST_R3__ extends DebugNode__POST_R3__ implements DebugEleme

// SVG elements return an `SVGAnimatedString` instead of a plain string for the `className`.
const className = element.className as string | SVGAnimatedString;
const classes = className && typeof className !== 'string' ? className.baseVal.split(' ') :
className.split(' ');
const classes =
typeof className !== 'string' ? className.baseVal.split(' ') : className.split(' ');

classes.forEach((value: string) => result[value] = true);

Expand Down

0 comments on commit c96ba23

Please sign in to comment.