webshrine / stdtyp/src / Assign
Type Alias: Assign<T, U, I>
Assign<
T
,U
,I
>:Pick
<I
, keyofI
>
Assign
Type Parameters
• T extends object
• U extends object
• I = Diff
<T
, U
> & Intersection
<U
, T
> & Diff
<U
, T
>
Desc
From U
assign properties to T
(just like object assign)
Example
ts
type Props = { name: string; age: number; visible: boolean };
type NewProps = { age: string; other: string };
// Expect: { name: string; age: number; visible: boolean; other: string; }
type ExtendedProps = Assign<Props, NewProps>;
Defined in
node_modules/.pnpm/utility-types@3.11.0/node_modules/utility-types/dist/mapped-types.d.ts:269