Type Alias NoStringIndex<T>

NoStringIndex<T>: {
    [K in keyof T as string extends K
        ? never
        : K]: T[K]
}

Utility to remove string indexes from types.

Type Parameters

  • T

    The type to remove string indexes from.

type Foo = {
a: string;
b: string;
[key: string]: string;
};
type Bar = RemoveStringIndexes<Foo>;
// Bar = {
// a: string;
// b: string;
// };