Skip to content

Flow error? #221

Open
Open
@bryndyment

Description

@bryndyment

Type of issue: bug

Chapter: 2

If it's a bug:

$ yarn test
yarn test v0.24.5
$ eslint src && flow
node_modules/eslint-plugin-jsx-a11y/src/rules/media-has-caption.js:53
v--------------------------------------
53: const trackChildren: Array = node.children.filter((child: Node) => {
54: if (child.type !== 'JSXElement') {
55: return false;
...:
60: });
-^ call of method filter. Function cannot be called on any member of intersection type
53: const trackChildren: Array = node.children.filter((child: Node) => {
^^^^^^^^^^^^^^^^^^^^ intersection
Member 1:
231: filter(callbackfn: typeof Boolean): Array<$NonMaybeType>;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function type. See lib: /private/tmp/flow/flowlib_8895270/core.js:231
Error:
v-----------------
53: const trackChildren: Array = node.children.filter((child: Node) => {
54: if (child.type !== 'JSXElement') {
55: return false;
...:
60: });
^ statics of function. This type is incompatible with
v----------------------
106: declare class Boolean {
107: constructor(value?: mixed): void;
108: static (value:any):boolean;
...:
111: }
^ statics of Boolean. See lib: /private/tmp/flow/flowlib_8895270/core.js:106
Member 2:
232: filter(callbackfn: (value: T, index: number, array: Array) => any, thisArg?: any): Array;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function type. See lib: /private/tmp/flow/flowlib_8895270/core.js:232
Error:
4924: children: Array;
^^^^ object type. This type is incompatible with the expected param type of. See: node_modules/ast-types-flow/lib/types.js:4924
53: const trackChildren: Array = node.children.filter((child: Node) => {
^^^^ Node

node_modules/eslint-plugin-jsx-a11y/src/rules/media-has-caption.js:59
59: return isTrackType(context, elementType(child.openingElement));
^^^^^^^^^^^^^^ property openingElement. Property not found in
59: return isTrackType(context, elementType(child.openingElement));
^^^^^ Node

src/index.js:7
7: const toby = new Dog('Toby')
^^^^^^^^^^^^^^^ constructor call. Constructor cannot be called on
7: const toby = new Dog('Toby')
^^^ CommonJS exports of "./dog"

Found 3 errors
error Command failed with exit code 2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions