Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: remove BlacklistedRecordProps #456

Merged
merged 1 commit into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading