Removing TSPropertySignature node adds commas to the type declaration
- Vorherrschende Sprache
- TypeScript
- Sterne
- 1.2k
- Forks
- 194
- Ø Merge
- 22 Std. 43 Min.
- Gemergte PRs (30 T.)
- 10
Beschreibung
I originally opened this issue on the jscodeshift project (facebook/jscodeshift#464), but I'm pretty sure it is originating on this library.
Basically when you try to remove a type property of a type definition you get unneeded commas like it was an object.
This only happens for typescript, if you use flow you have to use ObjectTypeProperty that works correctly.
Input:
```ts
type Props = {
__: translator;
form: Form;
isOpen: boolean;
closeModal: () => void;
};
```
Execute:
```ts
j(file.source).find(j.TSPropertySignature, { key: { name: "__" } }).remove();
```
Output:
```
type Props = {
form: Form;,
isOpen: boolean;,
closeModal: () => void;
};
```
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Reproduziere das Problem mit der bereitgestellten TypeScript-Typdefinition und der jscodeshift-Abfrage, die TSPropertySignature entfernt. Verfolge den Entfernungs- und Ausgabeweg für TypeScript-Eigenschaften und vergleiche ihn mit dem Verhalten von Flow ObjectTypeProperty. Erledigt ist die Aufgabe, wenn die verbleibenden Eigenschaften mit Semikolons und ohne zusätzliche Kommas ausgegeben werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 48/100