Skip to main content
Module

x/actionify/config/deps.ts>objectEntries

Create and manage your GitHub workflows with TypeScript and Deno.
Latest
variable objectEntries
import { objectEntries } from "https://deno.land/x/actionify@0.3.0/config/deps.ts";

A strongly-typed version of Object.entries().

This is useful since Object.entries() always returns an array of Array<[string, T]>. This function returns a strongly-typed array of the entries of the given object.

Examples

Example 1

import {objectEntries} from 'ts-extras';

const stronglyTypedEntries = objectEntries({a: 1, b: 2, c: 3});
//=> Array<['a' | 'b' | 'c', number]>

const untypedEntries = Object.entries(items);
//=> Array<[string, number]>

type

<Type extends Record<PropertyKey, unknown>>(value: Type) => [`${Exclude<keyof Type, symbol>}`, Type[`${Exclude<keyof Type, symbol>}`]][]