Skip to content

Commit

Permalink
fix(cdk/coercion): add the support for readonly array coercion
Browse files Browse the repository at this point in the history
Fixes a type definition of coerceArray so that it accepts both mutable and
immutable arrays.

Fixes #18806
  • Loading branch information
klemenoslaj committed Mar 12, 2020
1 parent 807498d commit bbba33c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cdk/coercion/array.ts
Expand Up @@ -7,6 +7,6 @@
*/

/** Wraps the provided value in an array, unless the provided value is an array. */
export function coerceArray<T>(value: T | T[]): T[] {
export function coerceArray<T>(value: T | readonly T[]): T[] {
return Array.isArray(value) ? value : [value];
}
2 changes: 1 addition & 1 deletion tools/public_api_guard/cdk/coercion.d.ts
Expand Up @@ -2,7 +2,7 @@ export declare function _isNumberValue(value: any): boolean;

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

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

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

Expand Down

0 comments on commit bbba33c

Please sign in to comment.