Skip to main content

NumberKeys TypeAlias

Extracts the keys of T which are numbers.

This API is reserved for internal system use and should not be imported directly. It may change at any time without notice.

For more information about our API support guarantees, see here.

Signature

export type NumberKeys<T, Transformed = {
readonly [Property in keyof T as number extends Property ? never : Property]: Property;
}> = Transformed[`${number}` & keyof Transformed];

Type Parameters

Parameter Default Description
T
Transformed { readonly [Property in keyof T as number extends Property ? never : Property]: Property; }

Remarks

The keys are extracted as strings which can be used to index T.

This handles cases like { x: 4 } & [5, 6] returning "0" and "1". Such cases are difficult to handle since keyof includes number in such cases, but the type can not be indexed by number. \