You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Compiler bug with await inside async function with object spread #19187
The resulting code should destructure the function's single argument, then do something—details of the function body are not relevant here as long as there is an await call inside another function call.
Actual behavior:
The compiler introduces a temporary variable _a that results in a runtime error: Cannot read property 'foo' of undefined.
The problem here is that the code above gets transpiled to the following (snipping prelude definitions of __awaiter, __generator, __rest etc.):
The problem is the introduction of var _a in line 3 which shadows the function argument that should be destructured in line 2: order does not matter with var as long as the declarations are inside the same function, i.e. in line 2 the _a from line 3 gets scope precedence over the _a from line 1.
Activity