Skip to content

ks

Strict-typed, shorthand Object.keys

Usage

ts
import { ks } from 'tsu'

const object = { frog: 'good', toad: 'bad' }

ks(object)
// ['frog', 'toad']

Type Definitions

ts
/**
 * @param obj - The object to extract the keys from.
 * @returns The keys.
 */
function ks<T extends object>(
  obj: T
): Array<`${keyof T & (string | number | boolean | null | undefined)}`>

Released under the MIT License.