import { type Spread } from "https://deno.land/x/actionify@0.3.0/src/deps/types.ts";
Mimic the type inferred by TypeScript when merging two objects using the spread operator.
Examples
Example 1
Example 1
import type {Spread} from 'type-fest';
type Foo = {
a: number;
b?: string;
};
type Bar = {
b?: number;
c: boolean;
};
const foo = {a: 1, b: '2'};
const bar = {c: false};
const fooBar = {...foo, ...bar};
type FooBar = Spread<Foo, Bar>;
// type FooBar = {
// a: number;
// b?: string | number | undefined;
// c: boolean;
// }
const baz = (argument: FooBar) => {
// Do something
}
baz(fooBar);
definition: Simplify<Spread_<FirstType, SecondType>>