From 5a0c06473c215ebb86ba09c0373e6f82e9f6eb50 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Wed, 17 Nov 2021 16:28:14 +0530 Subject: [PATCH] Use undefined instead of null --- src/utils/Lock.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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; } }