Skip to content

Commit

Permalink
fix: type error with RecursivePartial (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickofthyme authored Jun 25, 2019
1 parent 24cf000 commit f2b90df
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/lib/utils/commons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export function clamp(value: number, min: number, max: number): number {
// Can remove once we upgrade to TypesScript >= 3.5
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;


/**
* Replaces all properties on any type as optional, includes nested types
*
Expand All @@ -38,8 +37,8 @@ export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export type RecursivePartial<T> = {
[P in keyof T]?: T[P] extends (infer U)[]
? RecursivePartial<U>[]
: T[P] extends readonly (infer U)[] // eslint-disable-line prettier/prettier
? readonly RecursivePartial<U>[]
: T[P] extends ReadonlyArray<infer U> // eslint-disable-line @typescript-eslint/array-type
? ReadonlyArray<RecursivePartial<U>> // eslint-disable-line @typescript-eslint/array-type
: RecursivePartial<T[P]>
};

Expand Down

0 comments on commit f2b90df

Please sign in to comment.