Skip to main content
Module

x/scaffold/src/deps/npm.ts>objectKeys

scaffold your next project with style and 💗
Latest
function objectKeys
import { objectKeys } from "https://deno.land/x/scaffold@0.3.0/src/deps/npm.ts";

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

This is useful since Object.keys() always returns an array of strings. This function returns a strongly-typed array of the keys of the given object.

Examples

Example 1

import {objectKeys} from 'ts-extras';

const stronglyTypedItems = objectKeys({a: 1, b: 2, c: 3}); // => Array<'a' | 'b' | 'c'>
const untypedItems = Object.keys(items); // => Array<string>

Type Parameters

Type extends object

Returns

Array<ObjectKeys<Type>>