Skip to content

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 ParameterDescription
TSource type.
K extends keyof TKeys 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 }

Released under the Apache-2.0 License.