Type Alias StrictCanAssign<A, B, Then, Else>

StrictCanAssign<A, B, Then, Else>: Assignable<A, B, {
    $else: Else;
    $then: Then;
    distributive: false;
}>

Can A strictly assign to B.

All branches in an union A are assignable to B.

Type Parameters

  • A
  • B
  • Then = true
  • Else = false

use Assignable<A, B, { distributive: false }> instead

StrictCanAssign<number | string, number> // false
StrictCanAssign<number | string, number | string> // true