Skip to main content

FluidObjectProviderKeys TypeAlias

Produces a valid FluidObject key given a type and a property.

Signature

export type FluidObjectProviderKeys<T, TProp extends keyof T = keyof T> = string extends TProp ? never : number extends TProp ? never : TProp extends keyof Required<T>[TProp] ? Required<T>[TProp] extends Required<Required<T>[TProp]>[TProp] ? TProp : never : never;

Type Parameters

Parameter Constraint Default Description
T
TProp keyof T keyof T

Remarks

A valid FluidObject key is a property that exists on the incoming type as well as on the type of the property itself. For example: IProvideFoo.IFoo.IFoo This aligns with the FluidObject pattern expected to be used with all FluidObjects.

This utility type is meant for internal use by FluidObject

Example

interface IProvideFoo{
IFoo: IFoo
}
interface IFoo extends IProvideFoo{
foobar();
}

This pattern enables discovery, and delegation in a standard way which is central to FluidObject pattern.