UNPKG

@empathyco/x-components

Version:
30 lines (19 loc) 779 B
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [SubObject](./x-components.subobject.md) ## SubObject type Extracts a sub-type with the properties of `SomeObject` that have the `TargetPropertyType` type. **Signature:** ```typescript export type SubObject<SomeObject, TargetPropertyType> = { [Key in keyof SomeObject as SomeObject[Key] extends TargetPropertyType ? Key : never]: TargetPropertyType & SomeObject[Key]; }; ``` ## Example ```typescript interface Person { name: string, surname: string, age: number } type StringPersonProperties = SubObject<Person, string>; // { name: string; surname: string; }; ```