Type alias IfAvailable<T, Fallback>

IfAvailable<T, Fallback>: (boolean) extends (T extends never
        ? true
        : false)
    ? Fallback
    : keyof T extends never
        ? Fallback
        : T

If the lib "ES2015.Collection" is not included in tsconfig.json, types like ReadonlyArray, WeakMap etc. fall back to any (specified nowhere) or {} (from the node types), in both cases entering an infinite recursion in pattern matching type mappings This type can be used to cast these types to void in these cases.

Type Parameters

  • T

  • Fallback = void

Generated using TypeDoc