Improve long mapped type to across multiple line in Flow (#18779)

Co-authored-by: fisker Cheung <lionkay@gmail.com>
This commit is contained in:
Konv Suuandfisker Cheung authored and GitHub committed 2026-01-29 12:04:43 +08:00
1 parent e82cf92fb4
commit 9e58cbe5e0
4 files changed
+56 -12

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
#### Improve long mapped type to across multiple line (#18779 by @kovsu)
<!-- prettier-ignore -->
```flow
// Input
type MappedType = {
[KeyType in ValueType extends string ? VeryLongStringTypeNameHere : VeryLongNumberTypeNameHere]: KeyType
}
// Prettier stable
type MappedType = {
[KeyType in ValueType extends string
? VeryLongStringTypeNameHere
: VeryLongNumberTypeNameHere]: KeyType,
};
// Prettier main
type MappedType = {
[
KeyType in ValueType extends string
? VeryLongStringTypeNameHere
: VeryLongNumberTypeNameHere
]: KeyType,
};
```