Repository: babel/babel (TypeScript)

Issue:
[Bug]: @babel/preset-typescript initialize abstract properties when Typescript didn't
### 💻

- [ ] Would you like to work on a fix?

### How are you using Babel?

babel-loader (webpack)

### Input code

```ts
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

```json
{
  "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: https://github.com/babel/babel/issues/11542
But on that time TypeScript generates initializers for abstract properties. But since version 4.2 it didn't.


Hints:
Hey @Vampire2008! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant [Slack community](https://babeljs.slack.com) that typically always has someone willing to help. You can sign-up [here](https://slack.babeljs.io/) for an invite.

Patch:
diff --git a/packages/babel-plugin-transform-typescript/src/index.ts b/packages/babel-plugin-transform-typescript/src/index.ts
--- a/packages/babel-plugin-transform-typescript/src/index.ts
+++ b/packages/babel-plugin-transform-typescript/src/index.ts
@@ -160,6 +160,8 @@ export default declare((api, opts: Options) => {
             path.remove();
           }
         }
+      } else if (node.abstract) {
+        path.remove();
       } else if (!process.env.BABEL_8_BREAKING) {
         if (
           !allowDeclareFields &&


Test patch:
diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-allowDeclareFields-false/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-allowDeclareFields-false/input.ts
new file mode 100644
--- /dev/null
+++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-allowDeclareFields-false/input.ts
@@ -0,0 +1,3 @@
+abstract class A {
+    abstract prop: string;
+}
diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-allowDeclareFields-false/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-allowDeclareFields-false/options.json
new file mode 100644
--- /dev/null
+++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-allowDeclareFields-false/options.json
@@ -0,0 +1,3 @@
+{
+  "plugins": [["transform-typescript", { "allowDeclareFields": false }]]
+}
diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-allowDeclareFields-false/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-allowDeclareFields-false/output.js
new file mode 100644
--- /dev/null
+++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-allowDeclareFields-false/output.js
@@ -0,0 +1 @@
+class A {}
diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-allowDeclareFields-true/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-allowDeclareFields-true/input.ts
new file mode 100644
--- /dev/null
+++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-allowDeclareFields-true/input.ts
@@ -0,0 +1,3 @@
+abstract class A {
+    abstract prop: string;
+}
diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-allowDeclareFields-true/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-allowDeclareFields-true/options.json
new file mode 100644
--- /dev/null
+++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-allowDeclareFields-true/options.json
@@ -0,0 +1,3 @@
+{
+  "plugins": [["transform-typescript", { "allowDeclareFields": true }]]
+}
diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-allowDeclareFields-true/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-allowDeclareFields-true/output.js
new file mode 100644
--- /dev/null
+++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-allowDeclareFields-true/output.js
@@ -0,0 +1 @@
+class A {}
diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/accessor-allowDeclareFields-false/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/accessor-allowDeclareFields-false/output.js
--- a/packages/babel-plugin-transform-typescript/test/fixtures/class/accessor-allowDeclareFields-false/output.js
+++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/accessor-allowDeclareFields-false/output.js
@@ -4,11 +4,8 @@ class Foo {
   accessor #prop3 = 1;
   accessor [prop4] = 1;
   accessor prop5 = 1;
-  accessor prop6;
   accessor #p;
   accessor a;
   accessor aa;
-  accessor #s;
-  accessor f = 1;
   accessor g;
 }
diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/accessor-allowDeclareFields-true-babel-7/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/accessor-allowDeclareFields-true-babel-7/output.js
--- a/packages/babel-plugin-transform-typescript/test/fixtures/class/accessor-allowDeclareFields-true-babel-7/output.js
+++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/accessor-allowDeclareFields-true-babel-7/output.js
@@ -4,5 +4,4 @@ class Foo {
   accessor #prop3 = 1;
   accessor [prop4] = 1;
   accessor prop5 = 1;
-  accessor f = 1;
 }
diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/accessor-allowDeclareFields-true/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/accessor-allowDeclareFields-true/output.js
--- a/packages/babel-plugin-transform-typescript/test/fixtures/class/accessor-allowDeclareFields-true/output.js
+++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/accessor-allowDeclareFields-true/output.js
@@ -4,11 +4,8 @@ class Foo {
   accessor #prop3 = 1;
   accessor [prop4] = 1;
   accessor prop5 = 1;
-  accessor prop6;
   accessor #p;
   accessor a;
   accessor aa;
-  accessor #s;
-  accessor f = 1;
   accessor g;
 }