Prettier にコントリビュートした(14)
今回も尻拭い系
解決した Issue
https://github.com/prettier/prettier/issues/6417
こういうながーい Mapped Types があったときに
// Input
type PromisifyMethods<T> = { [P in keyof T]: T[P] extends Method ? PromisifyMethod<T[P]> : T[P] }
それが print-width を超えていれば折りたたむわけですが、セミコロンをつける設定にしていてもつかないというバグです。
// Output
type PromisifyMethods<T> = {
[P in keyof T]: T[P] extends Method ? PromisifyMethod<T[P]> : T[P]
};
ちなみに二度 Prettier を実行するとセミコロンがつくので、冪等性も破壊するバグです。
// Output(second)
type PromisifyMethods<T> = {
[P in keyof T]: T[P] extends Method ? PromisifyMethod<T[P]> : T[P];
};
出した PR
https://github.com/prettier/prettier/pull/6420
最初に言ったようにこれは自分の生み出したバグで、 https://github.com/prettier/prettier/pull/6146 でながーい Mapped Types の折りたたみ周りを少しいじったんですが、そのときにしくじりましたので直しました。
