As written, the new syntax example contains what look like implementation details (including the _ref1 variable), and the desugared version uses let instead of const... I'm guessing these were just copy/paste/editing errors and that it was intended to be more like the following?
function ajax({# url, headers, onSuccess #}) {
url = new URL(url) // throws TypeError('cannot assign to const `url`')
fetch(url, { headers }).then(onSuccess)
}
ajax({ url: 'http://example.com', onSuccess: console.log })
As written, the new syntax example contains what look like implementation details (including the
_ref1
variable), and the desugared version useslet
instead ofconst
... I'm guessing these were just copy/paste/editing errors and that it was intended to be more like the following?...desugars to...