Error ------------------------------------------------------------------------------------- fakelib/type_aliases.js:1:45 Cannot instantiate `ExactReactElement_DEPRECATED` because in type argument `ElementType`: [incompatible-type] - Either `unknown` [1] is incompatible with `component(...empty)` [2]. - Or `unknown` [1] is incompatible with `string` [3]. Flow is showing the union/intersection branches that got closest to passing. Other branches were less compatible and are not shown. To see all branches, re-run Flow with --show-all-branches. fakelib/type_aliases.js:1:45 1| type $jsx = ExactReactElement_DEPRECATED; // error: C is not known to be an element type ^ [1] References: /react.js:44:5 44| | component(...empty); ^^^^^^^^^^^^^^^^^^^ [2] /react.js:43:5 43| | string ^^^^^^ [3] Error ----------------------------------------------------------------------------------------- argless_function.js:10:3 Cannot assign `3` to `x.foo` because property `foo` is missing in `{}` [1]. [prop-missing] argless_function.js:10:3 10| x.foo = 3; // Error, the props type for Component is a sealed empty object. ^^^ References: argless_function.js:9:18 9| declare const x: React.ComponentProps; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error --------------------------------------------------------------------------------------- bad_default_props.js:15:18 Cannot use `React.Component` [1] with fewer than 1 type argument. [missing-type-arg] bad_default_props.js:15:18 15| class C3 extends React.Component { // error ^^^^^^^^^^^^^^^ References: /react.js:1261:28 1261| declare class Component { ^^^^^^^^^^^^^^^^^^^^^ [1] Error --------------------------------------------------------------------------------------- bad_default_props.js:20:18 Cannot use `React.Component` [1] with fewer than 1 type argument. [missing-type-arg] bad_default_props.js:20:18 20| class C4 extends React.Component { ^^^^^^^^^^^^^^^ References: /react.js:1261:28 1261| declare class Component { ^^^^^^^^^^^^^^^^^^^^^ [1] Error -------------------------------------------------------------------------------------------------- classes.js:23:3 Cannot extend `Component` [1] with `Foo` [2] because in property `setState` > the first parameter: property `y_` is missing in `{readonly y?: number, ...}` [3] but exists in `{y_: string, ...}` [4]. [incompatible-type] classes.js:23:3 23| setState(o: { y_: string, ... }): void { } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ References: classes.js:7:19 7| class Foo extends React.Component { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] classes.js:7:1 v------------------------------------------------ 7| class Foo extends React.Component { 8| static defaultProps: DefaultProps; 9| 10| is_mounted: boolean; 11| 12| static bar(): void {} 13| 14| qux(): void { 15| var _: string = this.props.x; 16| } 17| 18| constructor(props: Props) { 19| super(props); 20| this.state = { y: "" }; 21| } 22| 23| setState(o: { y_: string, ... }): void { } 24| 25| componentDidMount(): void { 26| this.is_mounted = true; 27| } 28| 29| componentWillReceiveProps( 30| nextProps: any, 31| nextContext: any 32| ): void { 33| this.qux(); 34| } 35| 36| } ^ [2] classes.js:7:42 7| class Foo extends React.Component { ^^^^^ [3] classes.js:23:15 23| setState(o: { y_: string, ... }): void { } ^^^^^^^^^^^^^^^^^^^ [4] Error ------------------------------------------------------------------------------------------------- classes.js:23:15 Cannot extend `Component` [1] with `Foo` [2] because in property `setState` > the first parameter: `{y_: string, ...}` [3] is incompatible with `null` [4]. [incompatible-type] classes.js:23:15 23| setState(o: { y_: string, ... }): void { } ^^^^^^^^^^^^^^^^^^^ [3] References: classes.js:7:19 7| class Foo extends React.Component { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] classes.js:7:1 v------------------------------------------------ 7| class Foo extends React.Component { 8| static defaultProps: DefaultProps; 9| 10| is_mounted: boolean; 11| 12| static bar(): void {} 13| 14| qux(): void { 15| var _: string = this.props.x; 16| } 17| 18| constructor(props: Props) { 19| super(props); 20| this.state = { y: "" }; 21| } 22| 23| setState(o: { y_: string, ... }): void { } 24| 25| componentDidMount(): void { 26| this.is_mounted = true; 27| } 28| 29| componentWillReceiveProps( 30| nextProps: any, 31| nextContext: any 32| ): void { 33| this.qux(); 34| } 35| 36| } ^ [2] /react.js:1270:23 1270| partialState: ?Readonly> | ((prevState: State, props: Props) => ?Readonly>), ^^^^^^^^^^^^^^^^^^^^^^^^^ [4] Error ------------------------------------------------------------------------------------------------- classes.js:23:15 Cannot extend `Component` [1] with `Foo` [2] because in property `setState` > the first parameter: `{y_: string, ...}` [3] is incompatible with `void` [4]. [incompatible-type] classes.js:23:15 23| setState(o: { y_: string, ... }): void { } ^^^^^^^^^^^^^^^^^^^ [3] References: classes.js:7:19 7| class Foo extends React.Component { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] classes.js:7:1 v------------------------------------------------ 7| class Foo extends React.Component { 8| static defaultProps: DefaultProps; 9| 10| is_mounted: boolean; 11| 12| static bar(): void {} 13| 14| qux(): void { 15| var _: string = this.props.x; 16| } 17| 18| constructor(props: Props) { 19| super(props); 20| this.state = { y: "" }; 21| } 22| 23| setState(o: { y_: string, ... }): void { } 24| 25| componentDidMount(): void { 26| this.is_mounted = true; 27| } 28| 29| componentWillReceiveProps( 30| nextProps: any, 31| nextContext: any 32| ): void { 33| this.qux(); 34| } 35| 36| } ^ [2] /react.js:1270:23 1270| partialState: ?Readonly> | ((prevState: State, props: Props) => ?Readonly>), ^^^^^^^^^^^^^^^^^^^^^^^^^ [4] Error ------------------------------------------------------------------------------------------------- classes.js:23:15 Cannot extend `Component` [1] with `Foo` [2] because in property `setState` > the first parameter: `{y_: string, ...}` [3] is incompatible with `(prevState: State, props: Props) => ?Readonly>` [4]. [incompatible-type] Functions without statics are not compatible with objects. classes.js:23:15 23| setState(o: { y_: string, ... }): void { } ^^^^^^^^^^^^^^^^^^^ [3] References: classes.js:7:19 7| class Foo extends React.Component { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] classes.js:7:1 v------------------------------------------------ 7| class Foo extends React.Component { 8| static defaultProps: DefaultProps; 9| 10| is_mounted: boolean; 11| 12| static bar(): void {} 13| 14| qux(): void { 15| var _: string = this.props.x; 16| } 17| 18| constructor(props: Props) { 19| super(props); 20| this.state = { y: "" }; 21| } 22| 23| setState(o: { y_: string, ... }): void { } 24| 25| componentDidMount(): void { 26| this.is_mounted = true; 27| } 28| 29| componentWillReceiveProps( 30| nextProps: any, 31| nextContext: any 32| ): void { 33| this.qux(); 34| } 35| 36| } ^ [2] /react.js:1270:52 1270| partialState: ?Readonly> | ((prevState: State, props: Props) => ?Readonly>), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [4] Error ------------------------------------------------------------------------------------------------- classes.js:15:21 Cannot assign `this.props.x` to `_` because `number` [1] is incompatible with `string` [2]. [incompatible-type] classes.js:15:21 15| var _: string = this.props.x; ^^^^^^^^^^^^ References: classes.js:4:19 4| type Props = { x: number, ... }; ^^^^^^ [1] classes.js:15:12 15| var _: string = this.props.x; ^^^^^^ [2] Error ------------------------------------------------------------------------------------------------- classes.js:20:23 Cannot assign object literal to `this.state` because in property `y`: `""` [1] is incompatible with `number` [2]. [incompatible-type] classes.js:20:23 20| this.state = { y: "" }; ^^ [1] References: classes.js:5:19 5| type State = { y: number, ... }; ^^^^^^ [2] Error ------------------------------------------------------------------------------------------------- classes.js:38:20 Cannot assign `0` to `Foo.defaultProps` because `0` [1] is incompatible with `DefaultProps` [2]. [incompatible-type] classes.js:38:20 38| Foo.defaultProps = 0; ^ [1] References: classes.js:8:24 8| static defaultProps: DefaultProps; ^^^^^^^^^^^^ [2] Error ------------------------------------------------------------------------------------------------- classes.js:39:32 Cannot create `Foo` element because property `x` is missing in `{...}` [1] but exists in `{readonly ref?: {ref?: React.RefSetter, x: number, ...}["ref"], readonly x: {ref?: React.RefSet...` [2]. [incompatible-type] classes.js:39:32 39| var foo: React.MixedElement = ; ^^^ References: classes.js:39:31 39| var foo: React.MixedElement = ; ^^^^^^ [1] classes.js:7:7 7| class Foo extends React.Component { ^^^ [2] Error -------------------------------------------------------------------------------------------- import-react.js:13:21 Cannot create `HelloMessage` element because in property `name`: `007` [1] is incompatible with `string` [2]. [incompatible-type] import-react.js:13:21 13| ; // number ~/~> string error ^^^ [1] References: import-react.js:11:52 11| class HelloMessage extends React.Component<{ name: string, ... }> {} ^^^^^^ [2] Error ---------------------------------------------------------------------------------------- object_component.js:13:13 Cannot create `Component` element because property `bar` is missing in `{}` [1] but exists in `{bar: number, foo?: number}` [2]. [incompatible-type] object_component.js:13:13 13| const _a = ; // Error, missing bar ^^^^^^^^^ References: object_component.js:13:12 13| const _a = ; // Error, missing bar ^^^^^^^^^^^^^ [1] object_component.js:8:11 8| (props: {foo?: number, bar: number}): React.Node, ^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2] Error ---------------------------------------------------------------------------------------- object_component.js:16:13 Cannot create `Component` element because property `baz` is extra in `{bar: 3, baz: 3, foo: 3}` [1] but missing in `{bar: number, foo?: number}` [2]. Exact objects do not accept extra props. [incompatible-type] object_component.js:16:13 16| const _d = ; // Error, baz is not in the config ^^^^^^^^^ References: object_component.js:16:12 16| const _d = ; // Error, baz is not in the config ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] object_component.js:8:11 8| (props: {foo?: number, bar: number}): React.Node, ^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2] Error ---------------------------------------------------------------------------------------- object_component.js:19:47 Cannot assign `null` to `_y` because `null` [1] is incompatible with `void` [2]. [incompatible-type] object_component.js:19:47 19| const _y: React.ElementRef = null; // Error, ref is undefined ^^^^ [1] References: object_component.js:19:11 19| const _y: React.ElementRef = null; // Error, ref is undefined ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2] Error ---------------------------------------------------------------------------------------- object_component.js:23:59 Cannot assign object literal to `_badProps2` because property `baz` is extra in object literal [1] but missing in `{bar: number, foo?: number}` [2]. Exact objects do not accept extra props. [incompatible-type] object_component.js:23:59 23| const _badProps2: React.ComponentProps = {bar: 3, foo: 3, baz: 3}; // Error extra baz ^^^^^^^^^^^^^^^^^^^^^^^^ [1] References: object_component.js:23:19 23| const _badProps2: React.ComponentProps = {bar: 3, foo: 3, baz: 3}; // Error extra baz ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2] Error --------------------------------------------------------------------------------------------------- props4.js:6:11 Cannot create `JDiv` element because in property `id`: `42` [1] is incompatible with `string` [2]. [incompatible-type] props4.js:6:11 6| ; ^^ [1] References: props4.js:3:41 3| class JDiv extends React.Component<{id: string, ...}> {} ^^^^^^ [2] Error --------------------------------------------------------------------------------------------------- props4.js:14:2 Cannot create `Example` element because property `bar` is missing in `{foo: "foo"}` [1] but exists in `{readonly bar: string, readonly ref?: React.RefSetter, ...}` [2]. [incompatible-type] props4.js:14:2 14| ; ^^^^^^^ References: props4.js:14:1 14| ; ^^^^^^^^^^^^^^^^^^^^^ [1] props4.js:8:7 8| class Example extends React.Component<{ bar: string, ... }> { ^^^^^^^ [2] Error --------------------------------------------------------------------------------------------------- state5.js:5:23 Cannot get `this.state.x` because property `x` is missing in `void` [1]. [incompatible-use] state5.js:5:23 5| return this.state.x; // error: need to declare type of state ^ References: /react.js:1261:44 1261| declare class Component { ^^^^ [1] Error -------------------------------------------------------------------------------------------------- state6.js:27:19 Cannot call `this.setState` with function bound to `partialState` because: [incompatible-type] - Either in the return value > property `bar`: `"42"` [1] is incompatible with `number` [2]. - Or inexact `() => {bar: "42"}` [3] is incompatible with exact `{readonly bar?: number, readonly foo?: number}` [4]. Flow is showing the union/intersection branches that got closest to passing. Other branches were less compatible and are not shown. To see all branches, re-run Flow with --show-all-branches. state6.js:27:19 v------------------------------------------- 27| this.setState(() => ({ // Error: `bar` should be a number. 28| bar: '42', 29| })); -^ [3] References: state6.js:28:12 28| bar: '42', ^^^^ [1] state6.js:5:33 5| type State = {foo: number, bar: number}; ^^^^^^ [2] state6.js:11:64 11| class MyComponent extends React.Component<{prop: number, ...}, State> { ^^^^^ [4] Error -------------------------------------------------------------------------------------------------- state6.js:31:29 Cannot get `prevState.nope` because property `nope` is missing in `State` [1]. [prop-missing] state6.js:31:29 31| console.log(prevState.nope); // Error: `nope` does not exist. ^^^^ References: state6.js:11:64 11| class MyComponent extends React.Component<{prop: number, ...}, State> { ^^^^^ [1] Error -------------------------------------------------------------------------------------------------- state6.js:34:25 Cannot get `props.nope` because property `nope` is missing in `{prop: number, ...}` [1]. [prop-missing] state6.js:34:25 34| console.log(props.nope); // Error: `nope` does not exist. ^^^^ References: state6.js:11:43 11| class MyComponent extends React.Component<{prop: number, ...}, State> { ^^^^^^^^^^^^^^^^^^^ [1] Error -------------------------------------------------------------------------------------------------- state6.js:39:26 Cannot call `this.setState` with `any` bound to `partialState` because: [incompatible-type] - Either in the first parameter: `number` [1] is incompatible with `State` [2]. - Or inexact `StateUpdater3` [3] is incompatible with exact `{readonly bar?: number, readonly foo?: number}` [2]. Flow is showing the union/intersection branches that got closest to passing. Other branches were less compatible and are not shown. To see all branches, re-run Flow with --show-all-branches. state6.js:39:26 39| this.setState(any as StateUpdater3); // Error: It has the wrong signature ^^^^^^^^^^^^^ [3] References: state6.js:9:27 9| type StateUpdater3 = {(n: number): number, foo: number, bar: number, ...}; ^^^^^^ [1] state6.js:11:64 11| class MyComponent extends React.Component<{prop: number, ...}, State> { ^^^^^ [2] Error --------------------------------------------------------------------------------------------------- state6.js:45:2 Cannot cast function to `Partial` because inexact `() => void` [1] is incompatible with exact `{bar?: number, foo?: number}` [2]. [incompatible-exact] state6.js:45:2 45| (() => {}) as Partial; // Error: Functions are not a valid object shape. ^^^^^^^^ [1] References: state6.js:45:23 45| (() => {}) as Partial; // Error: Functions are not a valid object shape. ^^^^^ [2] Found 25 errors