32
*/
33
get value(): T {
34
>
if (this._state === LazyValueState.Uninitialized) {
lazy.ts
35
>
this._state = LazyValueState.Running;
36
>
try {
37
>
this._value = this.executor();
38
>
} catch (err) {
39
this._error = err;
41
>
this._state = LazyValueState.Completed;
42
>
}
43
>
} else if (this._state === LazyValueState.Running) {
44
throw new Error('Cannot read the value of a lazy that is being initialized');
45
}
47
>
if (this._error) {
48
throw this._error;
49
}
50
return this._value!;
52
53
/**