benjamn / benjamn/ast-types

Removing TSPropertySignature node adds commas to the type declaration

オープン
#653 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
1.2k
フォーク
194
平均マージ
22時間 43分
マージ済み PR(30日)
10

説明

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;
};
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

提供された TypeScript 型定義と、TSPropertySignature を削除する jscodeshift クエリを使って問題を再現します。TypeScript のプロパティについて、削除から出力までの経路を追跡し、Flow ObjectTypeProperty の動作と比較します。残りのプロパティがセミコロン付きで、余分なカンマなしに出力されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。