Typescript, Typescript With React, Programming, JavaScript, Technology.
utility type is created to extract properties of a certain type: type ExtractProperties<T, U> = { [K in keyof T]: T[K] extends U ? K : never }[keyof T]; interface Car { brand: string; speed: number; color: string; } type StringKeysOfCar = ExtractProperties<Car, string>; // Result: "brand" | "color"