# ObservableWithProperty

typedef

A helper type that can be used as a constraint, ensuring the type is both observable and have the given property.

```typescript
// 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 ) {}
```

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-utils/src/observablemixin.ts#L1419)

<a id="type-parameters">

## Type parameters

### `TKey: extends PropertyKey`

### `TVal: any`

#### Value

`undefined extends TVal ? Observable & { [ P in TKey ]?: TVal } : Observable & { [ P in TKey ]?: TVal }`

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
