fixup! improve comment for `this` & static members

Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
This commit is contained in:
Miroslav Bajtoš 2020-03-02 13:04:01 +01:00
parent c7b88e9b8e
commit b01cd74b19
No known key found for this signature in database
GPG Key ID: 6F2304BA9361C7E3
1 changed files with 7 additions and 2 deletions

9
types/model.d.ts vendored
View File

@ -249,8 +249,13 @@ export declare class ModelBase {
// describe in TypeScript in a way that's easy to use by consumers.
// As a workaround, we include a copy of ObserverMixin members here.
//
// See also https://github.com/microsoft/TypeScript/issues/5863#issuecomment-410887254
// for more information about using `this` in static members.
// Ideally, we want to describe the context argument as
// `OperationHookContext<this>`. Unfortunately, that's not supported by
// TypeScript for static members. A nice workaround is described in
// https://github.com/microsoft/TypeScript/issues/5863#issuecomment-410887254
// - Describe the context using a generic argument `T`.
// - Use `this: T` argument to let the compiler infer what's the target
// model class we are going to observe.
/**
* Register an asynchronous observer for the given operation (event).