Skip to content

Commit 9e14140

Browse files
committed
fix(cdk/coercion): Return undefined when the fallback value is undefined
Returns undefined when the fallback argument is undefined for cases where the value is not a number Fixes #29425
1 parent c4f033c commit 9e14140

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cdk/coercion/number-property.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export type NumberInput = string | number | null | undefined;
1616
export function coerceNumberProperty(value: any): number;
1717
export function coerceNumberProperty<D>(value: any, fallback: D): number | D;
1818
export function coerceNumberProperty(value: any, fallbackValue = 0) {
19-
return _isNumberValue(value) ? Number(value) : fallbackValue;
19+
return _isNumberValue(value) ? Number(value) : arguments.length === 2 ? fallbackValue : 0;
2020
}
2121

2222
/**

0 commit comments

Comments
 (0)