@alanscodelog/utils
    Preparing search index...

    Function castType

    • Dummy function that casts a type for the remaining scope.

      function (aOrB:"A"|"B") {

      if (aOrB.includes("A")) {// non narrowing condition
      castType<"A">(aOrB)
      } else {
      castType<"B">(aOrB)
      }
      }

      Ideally this would return the value as well, but due to #34636 and #40562] this cannot be expressed in the type system.

      Type Parameters

      • T

      Parameters

      • _value: any

      Returns asserts _value is T