We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Destructured variable is referenced as a default value before being declared
function foo({ a, ...rest }: {}, foo: unknown = rest): unknown { }
{ "jsc": { "parser": { "syntax": "typescript", "tsx": false }, "target": "es2015", "loose": false, "minify": { "compress": false, "mangle": false } }, "module": { "type": "es6" }, "minify": false, "isModule": true }
https://play.swc.rs/?version=1.6.7&code=H4sIAAAAAAAAA0srzUsuyczPU0jLz9eoVkjUUdDT0ytKLS5RqLVSqK7VAYlbKZTmZefll%2Bcp2CqApDQRAgrVXFy1ClwA73sdnEYAAAA%3D&config=H4sIAAAAAAAAA1VPSQ7CMAy85xWRzxwACQ78gUdEwa2Csil2JaKqfydpk0Jv9iye8SykhDdpeMi5jGWJKhGmfS8IZc%2FqUxDgHJF0MpHh1FmmSg3KEq7QsjHAKo3I1YV0PV9uzQE2BMLuaJgz3gz5P1MHFxMSHYVVqvxo8ZgoWiq48JpWsv1S%2B24N7vAT9bD9MBh6dienCcXyBbnuEC8XAQAA
No response
SWC should output code for parameter default value after the destructuring code
Targeting ES2015 and below, transpiled code is incorrect as it references undeclared variable, pay attention to foo1 = rest:
foo1 = rest
function foo(_param, foo1 = rest) { var { a } = _param, rest = _object_without_properties(_param, [ "a" ]); }
For modern ES that supports object spreading output is correct:
function foo({ a, ...rest }, foo1 = rest) {}
1.6.7
The text was updated successfully, but these errors were encountered:
related issue:
Sorry, something went wrong.
No branches or pull requests
Describe the bug
Destructured variable is referenced as a default value before being declared
Input code
Config
Playground link (or link to the minimal reproduction)
https://play.swc.rs/?version=1.6.7&code=H4sIAAAAAAAAA0srzUsuyczPU0jLz9eoVkjUUdDT0ytKLS5RqLVSqK7VAYlbKZTmZefll%2Bcp2CqApDQRAgrVXFy1ClwA73sdnEYAAAA%3D&config=H4sIAAAAAAAAA1VPSQ7CMAy85xWRzxwACQ78gUdEwa2Csil2JaKqfydpk0Jv9iye8SykhDdpeMi5jGWJKhGmfS8IZc%2FqUxDgHJF0MpHh1FmmSg3KEq7QsjHAKo3I1YV0PV9uzQE2BMLuaJgz3gz5P1MHFxMSHYVVqvxo8ZgoWiq48JpWsv1S%2B24N7vAT9bD9MBh6dienCcXyBbnuEC8XAQAA
SWC Info output
No response
Expected behavior
SWC should output code for parameter default value after the destructuring code
Actual behavior
Targeting ES2015 and below, transpiled code is incorrect as it references undeclared variable, pay attention to
foo1 = rest
:For modern ES that supports object spreading output is correct:
Version
1.6.7
Additional context
No response
The text was updated successfully, but these errors were encountered: