Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: type error with RecursivePartial #248

Merged
merged 1 commit into from
Jun 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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