Skip to content

keys

The keys() method returns an array of an object's keys with precise typing, excluding symbols.

Interactive example

Syntax

typescript
function keys<
	GenericInput extends object
>(
	input: GenericInput
): (Exclude<keyof GenericInput, symbol>)[]

Parameters

  • input: The object whose keys you want to retrieve.

Return value

An array containing all the object's keys (excluding symbols) with precise typing.

See also

  • values - Returns an array of an object's values
  • entries - Returns an array of key-value pairs

Sources

Released under the MIT license.