Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/actionify/src/deps/types.ts>Spread

Create and manage your GitHub workflows with TypeScript and Deno.
Latest
type alias Spread
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

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);

Type Parameters

FirstType extends object
SecondType extends object
definition: Simplify<Spread_<FirstType, SecondType>>