💻
How are you using Babel?
babel-loader (webpack)
Input code
abstract class A {
abstract prop: string;
}
class B extends A {
get prop() {}
set prop(value: string) {
// shoud not to be called
}
}
Configuration file name
No response
Configuration
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"corejs": "3.27.1",
"modules": false
}
],
[
"@babel/preset-typescript",
{
"allowDeclareFields": true
},
],
],
"assumptions": {
"setPublicClassFields": true,
}
}
Current and expected behavior
Expected:
Constructor of abstract class shoudn't initialize abstract properties. Like in TypeScript.
Actual:
It initialized abstract properties and call setter on child class (in my environment it cause error, because some other properties doexn't initilized at this time)
Environment
System:
OS: Windows 10 10.0.22621
Binaries:
Node: 16.19.0
npm: 8.19.3
npmPackages:
@babel/core: ^7.20.7 => 7.20.12
@babel/preset-env: ^7.20.2 => 7.20.2
@babel/preset-typescript: ^7.18.6 => 7.18.6
babel-loader: ^9.1.0 => 9.1.2
webpack: ^5.75.0 => 5.75.0
Possible solution
No response
Additional context
There was a simmilar issue: #11542
But on that time TypeScript generates initializers for abstract properties. But since version 4.2 it didn't.
💻
How are you using Babel?
babel-loader (webpack)
Input code
Configuration file name
No response
Configuration
{ "presets": [ [ "@babel/preset-env", { "useBuiltIns": "usage", "corejs": "3.27.1", "modules": false } ], [ "@babel/preset-typescript", { "allowDeclareFields": true }, ], ], "assumptions": { "setPublicClassFields": true, } }Current and expected behavior
Expected:
Constructor of abstract class shoudn't initialize abstract properties. Like in TypeScript.
Actual:
It initialized abstract properties and call setter on child class (in my environment it cause error, because some other properties doexn't initilized at this time)
Environment
System:
OS: Windows 10 10.0.22621
Binaries:
Node: 16.19.0
npm: 8.19.3
npmPackages:
@babel/core: ^7.20.7 => 7.20.12
@babel/preset-env: ^7.20.2 => 7.20.2
@babel/preset-typescript: ^7.18.6 => 7.18.6
babel-loader: ^9.1.0 => 9.1.2
webpack: ^5.75.0 => 5.75.0
Possible solution
No response
Additional context
There was a simmilar issue: #11542
But on that time TypeScript generates initializers for abstract properties. But since version 4.2 it didn't.