Is this a regression?
The previous version in which this bug was not present was
No response
Description
coerceNumberProperty(thing, undefined) works the same way as coerceNumberProperty(thing), so it yields 0 if the thing isn't coercible to number. This is quite unexpected, because:
- In all other cases the fallback argument is respected.
- The return type is different:
coerceNumberProperty(thing, undefined) returns number | undefined, even though the implementation always yields number.
Reproduction
StackBlitz link:
Steps to reproduce:
1.
2.
Expected Behavior
Fallback argument should be respected even for undefined.
Actual Behavior
undefined isn't respected as a fallback.
Environment
- Angular: 17.0.6
- CDK/Material: 17.1.0
- Browser(s): *
- Operating System (e.g. Windows, macOS, Ubuntu): *
Is this a regression?
The previous version in which this bug was not present was
No response
Description
coerceNumberProperty(thing, undefined)works the same way ascoerceNumberProperty(thing), so it yields0if thethingisn't coercible to number. This is quite unexpected, because:coerceNumberProperty(thing, undefined)returnsnumber | undefined, even though the implementation always yieldsnumber.Reproduction
StackBlitz link:
Steps to reproduce:
1.
2.
Expected Behavior
Fallback argument should be respected even for
undefined.Actual Behavior
undefinedisn't respected as a fallback.Environment