Skip to content

entry ​

The entry() method creates a typed key-value pair (tuple).

Interactive example ​

Syntax ​

typescript
function entry<
	GenericKey extends ObjectKey,
	GenericValue extends AnyValue
>(
	key: GenericKey,
	value: GenericValue
): readonly [GenericKey, GenericInput]

Parameters ​

  • key: The key of the entry (string, number, or symbol).
  • value: The value associated with the key.

Return value ​

A read-only tuple [key, value] with strict typing.

See also ​

  • entries - Returns an array of an object's key-value pairs
  • fromEntries - Builds an object from entries

Released under the MIT license.