Type alias EitherAnd<A, B, C, D>

EitherAnd<A, B, C, D>: EitherOrBoth<A, B, C, D>

A | B | A & B. Supports up to 4 types, and it is composable. This is useful when you want to compose multiple options together, while preserving their required field and structure. If the types overlaps each other, you may run into some corner cases. But in general usage it should work as expected.

Type Parameters

  • A

  • B

  • C = void

  • D = void

Deprecated

renamed to EitherOrBoth

Example

type A = { src: string, minify?: boolean }
type B = { logLevel: number }
function config(options: EitherAnd<A, B>) { }

config({ logLevel: 1 })
config({ src: 'src' })
config({ src: 'src', minify: false })
config({ minify: false }) // INVALID

Generated using TypeDoc