Type Alias NarrowToExpected<Actual, Expected>

NarrowToExpected: Extract<Expected, Actual> extends never
    ? Extract<Actual, Expected> extends never
        ? Expected extends Actual ? Expected : never
        : Extract<Actual, Expected>
    : Extract<Expected, Actual>

Narrows the given Actual type to the given Expected type as much as possible, or falls back to just Expected itself.

Type Parameters

  • Actual
  • Expected