Support $ReadOnlyArray
- Dominant language
- JavaScript
- Stars
- 797
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Description
[](https://oss.issuehunt.io/r/gajus/flow-runtime/issues/199)
This is a:
- [ ] Bug Report
- [x] Feature Request
- [ ] Question
- [ ] Other
Which concerns:
- [x] flow-runtime
- [ ] babel-plugin-flow-runtime
- [ ] flow-runtime-validators
- [ ] flow-runtime-mobx
- [ ] flow-config-parser
- [ ] The documentation website
---
```
type Thing = $ReadOnlyArray;
const thing: Thing = [];
console.log(thing);
```
Output:
```
Thing must be an object
Expected: {
[Symbol(Symbol.iterator)]: () => Iterator;
toLocaleString: () => string;
concat: | S> (...items: Array) => Array;
entries: () => Iterator<[number, T]>;
every: (callbackfn: (value: T, index: number, array: $ReadOnlyArray) => any, thisArg?: any) => boolean;
filter: ((callbackfn: Boolean) => Array<$NonMaybeType>) | ((callbackfn: (value: T, index: number, array: $ReadOnlyArray) => any, thisArg?: any) => Array);
find: (callbackfn: (value: T, index: number, array: $ReadOnlyArray) => any, thisArg?: any) => T | void;
findIndex: (callbackfn: (value: T, index: number, array: $ReadOnlyArray) => any, thisArg?: any) => number;
forEach: (callbackfn: (value: T, index: number, array: $ReadOnlyArray) => any, thisArg?: any) => void;
includes: (searchElement: mixed, fromIndex?: number) => boolean;
indexOf: (searchElement: mixed, fromIndex?: number) => number;
join: (separator?: string) => string;
keys: () => Iterator;
lastIndexOf: (searchElement: mixed, fromIndex?: number) => number;
map: (callbackfn: (value: T, index: number, array: $ReadOnlyArray) => U, thisArg?: any) => Array;
reduce: ((callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: $ReadOnlyArray) => T, initialValue: void) => T) | ( (callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: $ReadOnlyArray) => U, initialValue: U) => U);
reduceRight: ((callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: $ReadOnlyArray) => T, initialValue: void) => T) | ( (callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: $ReadOnlyArray) => U, initialValue: U) => U);
slice: (start?: number, end?: number) => Array;
some: (callbackfn: (value: T, index: number, array: $ReadOnlyArray) => any, thisArg?: any) => boolean;
values: () => Iterator;
length: number;
[key: number]: T;
}
Actual Value: []
Actual Type: Array
```
[no errors with flow](https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoVAXAngBwKZgAqAFgJYB2A5mALxgAkASngIYAmA8uTFgIIBO-FlgA8AZwz8K1AD5hyAVwC2AIzz8AfAG50AYzjkJYDGSoAuIqep0A2gF0dqfYbgw8AOniUAFCekBKLSA)
---
IssueHunt Summary
### Backers (Total: $40.00)
- [ issuehunt](https://oss.issuehunt.io/u/issuehunt) ($40.00)
### Submitted pull Requests
- [#236 Initial support for $ReadOnlyArray](https://oss.issuehunt.io/r/gajus/flow-runtime/pull/236)
- [#300 feat: support generic conversion](https://oss.issuehunt.io/r/gajus/flow-runtime/pull/300)
---
#### [Become a backer now!](https://oss.issuehunt.io/r/gajus/flow-runtime/issues/199)
#### [Or submit a pull request to get the deposits!](https://oss.issuehunt.io/r/gajus/flow-runtime/issues/199)
### Tips
- Checkout the [Issuehunt explorer](https://oss.issuehunt.io/r/gajus/flow-runtime/) to discover more funded issues.
- Need some help from other developers? [Add your repositories](https://oss.issuehunt.io/r/new) on IssueHunt to raise funds.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the failing $ReadOnlyArray example and review submitted pull requests #236 and #300 to understand the existing implementation direction. Done means the example no longer reports the array as an object and runtime validation accepts the Flow type shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100