Skip to content

RequiredKeys

Under Construction

This documentation is auto-generated, and is a work in progress. Please see the source code at https://github.com/phetsims/phet-core/blob/main/js/types/RequiredKeys.ts for the most up-to-date information.

Overview

Type RequiredKeys

Returns the keys of T that are required.

See https://stackoverflow.com/questions/54520676/in-typescript-how-to-get-the-keys-of-an-object-type-whose-values-are-of-a-given and https://stackoverflow.com/questions/52984808/is-there-a-way-to-get-all-required-properties-of-a-typescript-object

@author Jonathan Olson <jonathan.olson@colorado.edu> @author Sam Reid (PhET Interactive Simulations)

import type { RequiredKeys } from 'scenerystack/phet-core';

{ [K in keyof T]-?: {} extends Pick<T, K> ? never : K }[keyof T]

Source Code

See the source for RequiredKeys.ts in the phet-core repository.