Skip to content

Commit bbba33c

Browse files
committed
fix(cdk/coercion): add the support for readonly array coercion
Fixes a type definition of coerceArray so that it accepts both mutable and immutable arrays. Fixes #18806
1 parent 807498d commit bbba33c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/cdk/coercion/array.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
*/
88

99
/** Wraps the provided value in an array, unless the provided value is an array. */
10-
export function coerceArray<T>(value: T | T[]): T[] {
10+
export function coerceArray<T>(value: T | readonly T[]): T[] {
1111
return Array.isArray(value) ? value : [value];
1212
}

tools/public_api_guard/cdk/coercion.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export declare function _isNumberValue(value: any): boolean;
22

33
export declare type BooleanInput = string | boolean | null | undefined;
44

5-
export declare function coerceArray<T>(value: T | T[]): T[];
5+
export declare function coerceArray<T>(value: T | readonly T[]): T[];
66

77
export declare function coerceBooleanProperty(value: any): boolean;
88

0 commit comments

Comments
 (0)