diff --git a/src/utils/Lock.ts b/src/utils/Lock.ts index ce7101de..238d88f9 100644 --- a/src/utils/Lock.ts +++ b/src/utils/Lock.ts @@ -15,8 +15,8 @@ limitations under the License. */ export class Lock { - private _promise: Promise | null = null; - private _resolve: (() => void) | null = null; + private _promise?: Promise; + private _resolve?: (() => void); tryTake(): boolean { if (!this._promise) { @@ -40,14 +40,14 @@ export class Lock { release(): void { if (this._resolve) { - this._promise = null; + this._promise = undefined; const resolve = this._resolve; - this._resolve = null; + this._resolve = undefined; resolve(); } } - released(): Promise | null { + released(): Promise | undefined { return this._promise; } }