hap-fluent / CharacteristicType
Type Alias: CharacteristicType<TService, TCharName>
ts
type CharacteristicType<TService, TCharName> = TService extends {
characteristics: infer C;
} ? C extends Record<TCharName, infer Char> ? Char : never : never;Defined in: packages/hap-fluent/src/type-utils.ts:52
Extract the FluentCharacteristic<T> type for a named characteristic on a service.
Type Parameters
| Type Parameter | Description |
|---|---|
TService | A FluentService type. |
TCharName extends string | The camelCase characteristic name string. |
Example
typescript
type OnChar = CharacteristicType<FluentService<typeof hap.Service.Lightbulb>, 'on'>;
// Result: FluentCharacteristic<boolean>