Support readonly as Flow variance annotation (#19022)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: fisker Cheung <lionkay@gmail.com>
This commit is contained in:
authored and GitHub committed 2026-04-12 07:43:22 +08:00
1 parent 9c044f33a8
commit 9d9d8914b6
5 files changed
+67 -3

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
#### Support `readonly` as a variance annotation (#19022 by @marcoww6)
Flow now accepts `readonly` as a property variance annotation, equivalent to `+` (covariant/read-only).
<!-- prettier-ignore -->
```jsx
// Input
type T = {
readonly foo: string,
};
// Prettier stable
SyntaxError
// Prettier main
type T = {
readonly foo: string,
};
```