💻
How are you using Babel?
@babel/cli
Input code
type Point = {
x: number;
y: number;
}
export function test({x, y}: Point) {
return x * y;
}
Configuration file name
.babelrc.json
Configuration
{
"plugins": [
"@babel/plugin-transform-parameters",
["@babel/plugin-transform-destructuring", {
"loose": true
}],
"@babel/plugin-syntax-typescript"
]
}
Current and expected behavior
Current output:
type Point = {
x: number;
y: number;
};
export function test(_ref) {
let x = _ref.x,
y = _ref.y;
return x * y;
}
Expected output:
type Point = {
x: number;
y: number;
};
export function test(_ref: Point) {
let x = _ref.x,
y = _ref.y;
return x * y;
}
Environment
System:
OS: macOS 12.2
Binaries:
Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
Yarn: 3.2.1 - /usr/local/bin/yarn
npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
npmPackages:
@babel/cli: ^7.17.10 => 7.17.10
@babel/core: ^7.18.5 => 7.18.5
@babel/plugin-syntax-typescript: ^7.17.12 => 7.17.12
@babel/plugin-transform-destructuring: ^7.18.0 => 7.18.0
Possible solution
No response
Additional context
Reproduction repo
💻
How are you using Babel?
@babel/cli
Input code
Configuration file name
.babelrc.json
Configuration
{ "plugins": [ "@babel/plugin-transform-parameters", ["@babel/plugin-transform-destructuring", { "loose": true }], "@babel/plugin-syntax-typescript" ] }Current and expected behavior
Current output:
Expected output:
Environment
System:
OS: macOS 12.2
Binaries:
Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
Yarn: 3.2.1 - /usr/local/bin/yarn
npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
npmPackages:
@babel/cli: ^7.17.10 => 7.17.10
@babel/core: ^7.18.5 => 7.18.5
@babel/plugin-syntax-typescript: ^7.17.12 => 7.17.12
@babel/plugin-transform-destructuring: ^7.18.0 => 7.18.0
Possible solution
No response
Additional context
Reproduction repo