Sign up (with export icon)

ObservableWithProperty

Api-typedef icon typedef

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 ) {}
Copy code

Type parameters