Skip to main content

RestrictiveStringRecord TypeAlias

Alternative to the built-in Record<string, T> type which is readonly and does not permit symbols.

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 RestrictiveStringRecord<T> = {
readonly [P in string]: T;
} & {
readonly [P in symbol]?: never;
};

Type Parameters

Parameter Description
T

Remarks

It would be nice if keyof RestrictiveStringRecord<T> returned string, but it does not: use keyof RestrictiveStringRecord<T> & string instead.