Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix references to uninitialized Promise variables.
The following code should cause the promise to be rejected, because the `promise` variable will not be initialized until after the `new Promise(...)` expression finishes evaluating, which happens after the callback returns: const promise = new Promise((resolve, reject) => { console.log(promise); }); TypeScript compiles this code down to `var promise = ...` instead of `const promise = ...`, which is probably why the `ReferenceError` is not fatal, but the `promise` variable is definitely undefined either way. It's a shame that TypeScript thinks this code is perfectly fine, though temporal dead zone errors are admittedly difficult to simulate (efficiently, at least) using `var` declarations. Good thing the `promise` property of `QueryPromise` objects is never used!
- Loading branch information