diff --git a/helpers/LazyVal.ts b/helpers/LazyVal.ts index cd97f6887478913592407f5907262d9240eba564..0217647ba57f2fd0399d85632e6106833975b438 100644 --- a/helpers/LazyVal.ts +++ b/helpers/LazyVal.ts @@ -1,11 +1,11 @@ class LazyVal<T> { private val: T = null; - constructor(private valLoader: () => Promise<T>) {} + constructor(private valLoader: () => Promise<T> | T) {} get value(): Promise<T> { return new Promise<T>(async (resolve) => { - if (this.val === null) { + if ( this.val === null ) { this.val = await this.valLoader(); }