Skip to main content
Module

x/enzastdlib/collections/object.ts>PickValues

enzastdlib is a set of TypeScript modules that follow a common design API philosophy aiming at sane defaults and ease-of-use targeting the Deno TypeScript runtime.
Latest
type alias PickValues
import { type PickValues } from "https://deno.land/x/enzastdlib@v0.0.4/collections/object.ts";

Returns an Object where members with the given type are picked into a new Object type.

Examples

Example 1

import type { PickValues } from 'https://deno.land/x/enzastdlib/collections/mod.ts';

const MY_CONSTANT_OBJECT = {
    myBoolean: false,

    myNumber: 42,

    myString: 'Hello World',

    otherNumber: 84,
} as const;

type FilteredValues = PickValues<typeof MY_CONSTANT_OBJECT, number>; // `{ readonly myNumber: 42; readonly otherNumber: 84; }`
definition: [Key in keyof Objin keyof Obj[Key] extends Value ? Key : never]: Obj[Key]