Bug Report
Current Behavior
When using parameter decorators in class constructors combined with the public or private keyword, Babel loses the import information.
If public/private is not used, it works correctly.
This is a similar issue to #8634 but specifically regarding the use of public/private.
Input Code
import { inject } from "./inject";
import { UserService } from "./UserService";
export class Store {
constructor(@inject(UserService) private userService: UserService) {}
}
Expected behavior/code
I would expect an output along the lines of:
Object(_includes__WEBPACK_IMPORTED_MODULE_1__["inject"])(_PageStore__WEBPACK_IMPORTED_MODULE_2__["UserService"])(Store.prototype, "", 0);
But what I get is:
inject(UserService)(Store.prototype, "", 0);
Which doesn't work because inject and UserService aren't valid variables.
Babel Configuration
.babelrc
{
"presets": [
"@babel/preset-typescript",
"@babel/react"
],
"plugins": [
["@babel/proposal-decorators", { "legacy": true }],
["@babel/proposal-class-properties", { "loose": true }],
"./parameterDecorator.js" // plugin to add calls to parameter decorators: https://github.com/WarnerHooh/babel-plugin-parameter-decorator
]
}
Environment
- Babel version: 7.4.3
- Node/npm version: Node 11.10.0, npm 6.7.0
- OS: Windows 10
- How you are using Babel: WebPack
Bug Report
Current Behavior
When using parameter decorators in class constructors combined with the
publicorprivatekeyword, Babel loses the import information.If public/private is not used, it works correctly.
This is a similar issue to #8634 but specifically regarding the use of public/private.
Input Code
Expected behavior/code
I would expect an output along the lines of:
But what I get is:
Which doesn't work because
injectandUserServicearen't valid variables.Babel Configuration
.babelrc
Environment