Improve quality of Typescript types (#10742)
This commit is contained in:
parent
542bf68c63
commit
a4f0b80692
30 changed files with 74 additions and 75 deletions
|
@ -18,8 +18,8 @@ limitations under the License.
|
|||
* Utility class for lazily getting a variable.
|
||||
*/
|
||||
export class LazyValue<T> {
|
||||
private val: T;
|
||||
private prom: Promise<T>;
|
||||
private val?: T;
|
||||
private prom?: Promise<T>;
|
||||
private done = false;
|
||||
|
||||
public constructor(private getFn: () => Promise<T>) {}
|
||||
|
@ -36,7 +36,7 @@ export class LazyValue<T> {
|
|||
* Gets the value without invoking a get. May be undefined until the
|
||||
* value is fetched properly.
|
||||
*/
|
||||
public get cachedValue(): T {
|
||||
public get cachedValue(): T | undefined {
|
||||
return this.val;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue