common-stuff
    Preparing search index...

    Function hasKeys

    • Checks if unknown object have provided keys.

      Type Parameters

      • T
      • Key extends PropertyKey

      Parameters

      • obj: T
      • keys: readonly Key[]

      Returns obj is T extends { [K in PropertyKey]: any }
          ? Extract<{ [K in PropertyKey]: any }, T<T>>
          : Extract<{ [K in PropertyKey]: unknown }, T>

      if (hasKeys(value, ['a', 'b'])) {
      console.log(value.a, value.b)
      }