ObservableWithProperty
Type parameters
Value
undefined extends TVal ? Observable & { [ P in TKey ]?: TVal } : Observable & { [ P in TKey ]?: TVal }
A helper type that can be used as a constraint, ensuring the type is both observable and have the given property.
// Ensures that `obj` is `Observable` and have property named 'abc'.
function f<O extends ObservableWithProperty<'abc'>>( obj: O ) {}
// Ensures that `obj` is `Observable` and have property named 'abc' with value `number`.
function f<O extends ObservableWithProperty<'abc', number>>( obj: O ) {}
TKey : extends PropertyKeyTVal : anyundefined extends TVal ? Observable & { [ P in TKey ]?: TVal } : Observable & { [ P in TKey ]?: TVal }