hap-fluent / OptionalProperties
Type Alias: OptionalProperties<T, K>
ts
type OptionalProperties<T, K> = Omit<T, K> & Partial<Pick<T, K>>;Defined in: packages/hap-fluent/src/type-utils.ts:159
Make a subset of properties on T optional while leaving others unchanged.
Type Parameters
| Type Parameter | Description |
|---|---|
T | Source type. |
K extends keyof T | Keys to make optional. |
Example
typescript
type Config = { host: string; port: number; timeout: number };
type PartialConfig = OptionalProperties<Config, 'timeout'>;
// Result: { host: string; port: number; timeout?: number }