gajus/flow-runtime

















Do you want to work on this issue?
You can request for a bounty in order to promote it!
Support $ReadOnlyArray #199
christophehurpeau posted onGitHub
This is a:
- Bug Report
- Feature Request
- Question
- Other
Which concerns:
- flow-runtime
- babel-plugin-flow-runtime
- flow-runtime-validators
- flow-runtime-mobx
- flow-config-parser
- The documentation website
type Thing = $ReadOnlyArray<string | number>;
const thing: Thing = [];
console.log(thing);
Output:
Thing must be an object
Expected: {
[Symbol(Symbol.iterator)]: () => Iterator<T>;
toLocaleString: () => string;
concat: <S, Item: $ReadOnlyArray<S> | S> (...items: Array<Item>) => Array<T | S>;
entries: () => Iterator<[number, T]>;
every: (callbackfn: (value: T, index: number, array: $ReadOnlyArray<T>) => any, thisArg?: any) => boolean;
filter: ((callbackfn: Boolean) => Array<$NonMaybeType<T>>) | ((callbackfn: (value: T, index: number, array: $ReadOnlyArray<T>) => any, thisArg?: any) => Array<T>);
find: (callbackfn: (value: T, index: number, array: $ReadOnlyArray<T>) => any, thisArg?: any) => T | void;
findIndex: (callbackfn: (value: T, index: number, array: $ReadOnlyArray<T>) => any, thisArg?: any) => number;
forEach: (callbackfn: (value: T, index: number, array: $ReadOnlyArray<T>) => any, thisArg?: any) => void;
includes: (searchElement: mixed, fromIndex?: number) => boolean;
indexOf: (searchElement: mixed, fromIndex?: number) => number;
join: (separator?: string) => string;
keys: () => Iterator<number>;
lastIndexOf: (searchElement: mixed, fromIndex?: number) => number;
map: <U> (callbackfn: (value: T, index: number, array: $ReadOnlyArray<T>) => U, thisArg?: any) => Array<U>;
reduce: ((callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: $ReadOnlyArray<T>) => T, initialValue: void) => T) | (<U> (callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: $ReadOnlyArray<T>) => U, initialValue: U) => U);
reduceRight: ((callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: $ReadOnlyArray<T>) => T, initialValue: void) => T) | (<U> (callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: $ReadOnlyArray<T>) => U, initialValue: U) => U);
slice: (start?: number, end?: number) => Array<T>;
some: (callbackfn: (value: T, index: number, array: $ReadOnlyArray<T>) => any, thisArg?: any) => boolean;
values: () => Iterator<T>;
length: number;
[key: number]: T;
}
Actual Value: []
Actual Type: Array<any>