Skip to content

Commit

Permalink
Make Part type aware of array or object target (solidjs#665)
Browse files Browse the repository at this point in the history
  • Loading branch information
rturnq authored Oct 4, 2021
1 parent 629203c commit 3f213df
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/solid/store/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,11 @@ export type ArrayFilterFn<T> = (
index: number
) => boolean;

export type Part<T> = keyof T | Array<keyof T> | StorePathRange | ArrayFilterFn<T>; // changing this to "T extends any[] ? ArrayFilterFn<T> : never" results in depth limit errors
export type Part<T> = T extends any[]
? keyof T | Array<keyof T> | ArrayFilterFn<T> | StorePathRange
: T extends object
? keyof T | Array<keyof T>
: never;

export type NullableNext<T, K> = K extends keyof T
? T[K]
Expand Down

0 comments on commit 3f213df

Please sign in to comment.