-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Labels
awaiting author replyThe author hasn't replied to a question, and it's been a few daysThe author hasn't replied to a question, and it's been a few days
Description
It's unexpected that assign isn't a straight mapping to Object.assign and the differences with it and lodash are very stark. Not modifying the original object is unexpected. It functions similar to lodash's object merge, but doesn't support multiple objects.
Lastly, the types are broken. I ran into this with FastifyHelmetOptions for both args and got a typescript error Type is infinite.
The merge of A and B is just A & B in lodash which makes sense. But radashi uses:
type Assign<TInitial extends object, TOverride extends object> = TInitial extends any ? TOverride extends any ? SimplifyMutable<Omit<TInitial, keyof TOverride> & Omit<TOverride, keyof TInitial> & (Pick<TInitial, keyof TInitial & keyof TOverride> extends infer TConflictInitial ? Pick<TOverride, keyof TInitial & keyof TOverride> extends infer TConflictOverride ? {
[K in RequiredKeys<TConflictOverride>]: AssignDeep<TConflictInitial[K & keyof TConflictInitial], TConflictOverride[K]>;
} & {
[K in RequiredKeys<TConflictInitial> & OptionalKeys<TConflictOverride>]: AssignDeep<TConflictInitial[K], TConflictOverride[K], true>;
} & {
[K in OptionalKeys<TConflictInitial> & OptionalKeys<TConflictOverride>]?: AssignDeep<TConflictInitial[K], TConflictOverride[K], true>;
} : unknown : unknown)> : never : never;
which I imagine fails for any recursive type.
Metadata
Metadata
Assignees
Labels
awaiting author replyThe author hasn't replied to a question, and it's been a few daysThe author hasn't replied to a question, and it's been a few days