Skip to content

Commit

Permalink
refactor: rename some types
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaStevens committed May 19, 2024
1 parent fa9ace2 commit 53a82bd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/deepmerge-into.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

/**
Expand All @@ -35,7 +35,7 @@ export function deepmergeInto<
>(
target: Target,
...objects: Ts
): asserts target is FlatternAlias<
): asserts target is SimplifyObject<
Target &
DeepMergeHKT<
[Target, ...Ts],
Expand All @@ -50,7 +50,7 @@ export function deepmergeInto<
>(
target: Target,
...objects: Ts
): asserts target is FlatternAlias<
): asserts target is SimplifyObject<
Target &
DeepMergeHKT<
[Target, ...Ts],
Expand Down
4 changes: 2 additions & 2 deletions src/types/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import {
type FilterOutNever,
type FlattenTuples,
type FlatternAlias,
type SimplifyObject,
type TransposeTuple,
type TupleToIntersection,
type TuplifyUnion,
Expand Down Expand Up @@ -88,7 +88,7 @@ export type DeepMergeRecordsDefaultHKT<
M,
> =
Ts extends ReadonlyArray<Record<PropertyKey, unknown>>
? FlatternAlias<
? SimplifyObject<
DeepMergeRecordMetaDefaultHKTProps<RecordsToRecordMeta<Ts>, MF, M>
>
: never;
Expand Down
6 changes: 2 additions & 4 deletions src/types/utils.ts
Original file line number Diff line number Diff line change
@@ -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> = T extends {} ? FlattenRecord<T> : T;

type FlattenRecord<T extends {}> = {
export type SimplifyObject<T extends {}> = {
[K in keyof T]: T[K];
} & {};

Expand Down

0 comments on commit 53a82bd

Please sign in to comment.