From 3da5b890daf2bfcc018a8ce59956df900c26247f Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Sun, 19 May 2024 16:02:25 +1200 Subject: [PATCH] refactor: rename some types --- src/deepmerge-into.ts | 6 +++--- src/types/defaults.ts | 4 ++-- src/types/utils.ts | 6 ++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/deepmerge-into.ts b/src/deepmerge-into.ts index f5a095a6..d3574d0b 100644 --- a/src/deepmerge-into.ts +++ b/src/deepmerge-into.ts @@ -9,7 +9,7 @@ import { type DeepMergeMergeIntoFunctionUtils, type Reference, } from "./types"; -import { type FlatternAlias } from "./types/utils"; +import { type SimplifyObject } from "./types/utils"; import { ObjectType, getObjectType } from "./utils"; /** @@ -35,7 +35,7 @@ export function deepmergeInto< >( target: Target, ...objects: Ts -): asserts target is FlatternAlias< +): asserts target is SimplifyObject< Target & DeepMergeHKT< [Target, ...Ts], @@ -50,7 +50,7 @@ export function deepmergeInto< >( target: Target, ...objects: Ts -): asserts target is FlatternAlias< +): asserts target is SimplifyObject< Target & DeepMergeHKT< [Target, ...Ts], diff --git a/src/types/defaults.ts b/src/types/defaults.ts index 55ed9e8f..18bedd49 100644 --- a/src/types/defaults.ts +++ b/src/types/defaults.ts @@ -7,7 +7,7 @@ import { import { type FilterOutNever, type FlattenTuples, - type FlatternAlias, + type SimplifyObject, type TransposeTuple, type TupleToIntersection, type TuplifyUnion, @@ -88,7 +88,7 @@ export type DeepMergeRecordsDefaultHKT< M, > = Ts extends ReadonlyArray> - ? FlatternAlias< + ? SimplifyObject< DeepMergeRecordMetaDefaultHKTProps, MF, M> > : never; diff --git a/src/types/utils.ts b/src/types/utils.ts index e2f85ff6..dd9e8bed 100644 --- a/src/types/utils.ts +++ b/src/types/utils.ts @@ -1,10 +1,8 @@ /** - * Flatten a complex type such as a union or intersection of objects into a + * Simplify a complex type such as a union or intersection of objects into a * single object. */ -export type FlatternAlias = T extends {} ? FlattenRecord : T; - -type FlattenRecord = { +export type SimplifyObject = { [K in keyof T]: T[K]; } & {};