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 061d000
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/utility-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ 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 061d000

Please sign in to comment.