Skip to content

Support $ReadOnlyArray #199

Description

@christophehurpeau

Issuehunt badges

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>

no errors with flow


IssueHunt Summary

Backers (Total: $40.00)

Submitted pull Requests


Become a backer now!

Or submit a pull request to get the deposits!

Tips

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions