diff --git a/libs/common/src/platform/misc/using-required.ts b/libs/common/src/platform/misc/using-required.ts index f641b9f312f..3e341e28e76 100644 --- a/libs/common/src/platform/misc/using-required.ts +++ b/libs/common/src/platform/misc/using-required.ts @@ -1,9 +1,24 @@ export type Disposable = { [Symbol.dispose]: () => void }; /** - * Types implementing this type must be used together with the `using` keyword + * Types implementing this type must be used together with the `using` keyword, + * a rule which is enforced by the linter. * - * @example using ref = rc.take(); + * @deprecated At this time only Chrome supports the `using` keyword. + * Wait for other browsers to catch up before using this type. + * @example + * ``` + * class Resource implements UsingRequired { + * [Symbol.dispose]() { + * // free the resource + * } + * } + * + * function useResource() { + * using resource = new Resource(); + * // resource is disposed when the block ends + * } + * ``` */ // We want to use `interface` here because it creates a separate type. // Type aliasing would not expose `UsingRequired` to the linter.