From 203f65617551f05272d11d0c4e84a180cace937d Mon Sep 17 00:00:00 2001 From: Danylo Batishchev Date: Tue, 23 Jul 2024 14:04:42 +0200 Subject: [PATCH] feat: handle newtype primitives --- src/utility-types.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/utility-types.ts b/src/utility-types.ts index 74b604b..21b41c3 100644 --- a/src/utility-types.ts +++ b/src/utility-types.ts @@ -13,7 +13,16 @@ import type { } from './create-mutation-keys.types'; import type { AnyMutableOrReadonlyArray } from './types'; -type MergeInsertions = T extends object ? { [K in keyof T]: MergeInsertions } : T; +type Primitive = + | boolean + | string + | number + | bigint + | symbol + | undefined + | null + +type MergeInsertions = T extends Primitive ? T : T extends object ? { [K in keyof T]: MergeInsertions } : T; type inferRecordMutationKeys = { [P in Exclude]: Target[P] extends AnyMutableOrReadonlyArray ? Target[P]