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:
5 files changed
+67
-3
No files matched your search
@@ -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,
|
||||
};
|
||||
```
|
||||
Reference in new issue
Block a user