Skip to content

Commit

Permalink
perf: remove BlacklistedRecordProps
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaStevens committed May 19, 2024
1 parent 1982e56 commit 19d4944
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
13 changes: 1 addition & 12 deletions src/types/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ export type DeepMergeMergeFunctionsDefaultURIs = Readonly<{
DeepMergeOthersURI: DeepMergeLeafURI;
}>;

/**
* A union of all the props that should not be included in type information for
* merged records.
*/
type BlacklistedRecordProps = "__proto__";

/**
* Deep merge records.
*/
Expand All @@ -61,12 +55,7 @@ export type DeepMergeRecordsDefaultHKT<
M,
> =
Ts extends Readonly<readonly [unknown, ...Readonly<ReadonlyArray<unknown>>]>
? FlatternAlias<
Omit<
DeepMergeRecordsDefaultHKTInternalProps<Ts, MF, M>,
BlacklistedRecordProps
>
>
? FlatternAlias<DeepMergeRecordsDefaultHKTInternalProps<Ts, MF, M>>
: {};

/**
Expand Down
7 changes: 5 additions & 2 deletions src/types/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
* Flatten a complex type such as a union or intersection of objects into a
* single object.
*/
export type FlatternAlias<T> =
Is<T, unknown> extends true ? T : { [P in keyof T]: T[P] } & {};
export type FlatternAlias<T> = T extends {} ? FlatternRecord<T> : T;

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

/**
* Get the value of the given key in the given object.
Expand Down

0 comments on commit 19d4944

Please sign in to comment.