Hex Core JS
    Preparing search index...

    Function isKeyOf

    • Reports whether the given key is a key of the given object. Acts as a typeguard.

      Useful for dealing with the TypeScript error "Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{...}'." when using dynamic keys with fixed object types.

      Type Parameters

      • K extends string | number | symbol

      Parameters

      • key: any

        The key to check.

      • obj: Record<K, any>

        The object to check against.

      Returns key is K