Skip to content

Commit

Permalink
fix(ts): change readonly array syntax to support older tsc (#385)
Browse files Browse the repository at this point in the history
`readonly T[]` is new syntax for `ReadonlyArray` which is supported in typescript older than 3.4.
As of now everything works but throws error while compiling in angular 7
  • Loading branch information
preetham1290 authored Jun 15, 2020
1 parent 637f343 commit 59eefd7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,9 @@ export function getType(object: unknown): string {
return type;
}

export function copyAndExtendArray<T>(arr: readonly T[], newValue: T): T[];
export function copyAndExtendArray<T>(arr: ReadonlyArray<T>, newValue: T): T[];
export function copyAndExtendArray<A, V>(
arr: readonly A[],
arr: ReadonlyArray<A>,
newValue: V
): (A | V)[];
/**
Expand All @@ -485,7 +485,7 @@ export function copyAndExtendArray<A, V>(
* @returns A new array with all items from arr and newValue (which is last).
*/
export function copyAndExtendArray<A, V>(
arr: readonly A[],
arr: ReadonlyArray<A>,
newValue: V
): (A | V)[] {
return [...arr, newValue];
Expand Down

0 comments on commit 59eefd7

Please sign in to comment.