TypeScript Version: 3.9.1-rc, 4.0.0-dev.20200428
Search Terms: cannot reference identifier
Code
function test0({ a = 0, b = a } = {}) {
return { a, b };
}
function test1({ c: { a = 0, b = a } = {} } = {}) {
return { a, b };
}
Expected behavior: Doesn't fail
Actual behavior: Fails with Parameter '{ a = 0, b = a }' cannot reference identifier 'a' declared after it.(2373)
Playground Link: https://www.typescriptlang.org/play/?noImplicitAny=false&ts=4.0.0-dev.20200428&ssl=8&ssc=1&pln=1&pc=1#code/GYVwdgxgLglg9mABFApgZygBgBQG9ECGiAvIpgDSIBGJhiAvrbvQJSK4BQi3iATilBC8k+ApRr0A3B3ocOoSLATJ0UAIx5EEAFzs6pCtVpFGpZgyat2XHv0HC9Yo1JkcgA
Related Issues: #38130