Skip to content

Commit

Permalink
feat: handle newtype primitives
Browse files Browse the repository at this point in the history
  • Loading branch information
plneple committed Jul 23, 2024
1 parent bd24672 commit 203f656
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/utility-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@ import type {
} from './create-mutation-keys.types';
import type { AnyMutableOrReadonlyArray } from './types';

type MergeInsertions<T> = T extends object ? { [K in keyof T]: MergeInsertions<T[K]> } : T;
type Primitive =
| boolean
| string
| number
| bigint
| symbol
| undefined
| null

type MergeInsertions<T> = T extends Primitive ? T : T extends object ? { [K in keyof T]: MergeInsertions<T[K]> } : T;

type inferRecordMutationKeys<Target extends object> = {
[P in Exclude<keyof Target, 'mutationFn'>]: Target[P] extends AnyMutableOrReadonlyArray ? Target[P]
Expand Down

0 comments on commit 203f656

Please sign in to comment.