I believe I have found an edge case affecting those using older versions of Flow (<0.126.0), which this PR aims to solve.
It's easiest to see what this PR does with some examples:
TypeScript input
Before
After
```ts
type Map = {
[key: string]: string;
};
```
```js
type Map = {
[key: string]: string,
...
};
```
The `...` here is ignored by Flow, so it can be removed
```js
type Map = {
[key: string]: string,
};
```
Same as above with --no-inexact
```js
type Map = {|
[key: string]: string,
|};
```
Using indexers in exact objects was unsupported in Flow [up until v0.126.0](https://github.com/facebook/flow/blob/main/Changelog.md#01260).
```js
type Map = {
[key: string]: string,
};
```
Same as above; no exact syntax for types containing indexers.
An "exact" object with an indexer doesn't really make sense, since the purpose of the indexer is to allow you to provide arbitrary keys, so removing exactness from an object with an indexer should be a no-op in Flow >=0.126.0 and should fix unusable types for older Flow versions
Thank you so much to all the contributors! ❤️ flowgen is a fantastic tool!
I believe I have found an edge case affecting those using older versions of Flow (<0.126.0), which this PR aims to solve.
It's easiest to see what this PR does with some examples:
--no-inexact
Thank you so much to all the contributors! ❤️
flowgen
is a fantastic tool!