Skip to content

Commit

Permalink
[flow] Remove react.ref_as_prop=disabled override in component_type…
Browse files Browse the repository at this point in the history
… test suite

Summary:
These are essentially the same errors, except that these ones are a result of direct `React.RefSetter<void> ~> React.RefSetter<number>` subtyping.

Changelog: [internal]

Reviewed By: jbrown215

Differential Revision: D66887059

fbshipit-source-id: 693db2977fad9d71fb46f2a8d23f38eae437d117
  • Loading branch information
SamChou19815 authored and facebook-github-bot committed Dec 11, 2024
1 parent c292f98 commit 8e5ecac
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 14 deletions.
1 change: 0 additions & 1 deletion tests/component_type/.flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
component_syntax=true
all=true
no_flowlib=false
react.ref_as_prop=disabled

[lints]
internal-type=off
88 changes: 75 additions & 13 deletions tests/component_type/component_type.exp
Original file line number Diff line number Diff line change
Expand Up @@ -618,16 +618,47 @@ References:

Error ------------------------------------------------------------------------------------------- function_lower.js:12:1

Cannot cast `Component` to component because undefined [1] is incompatible with number [2]. [incompatible-cast]
Cannot cast `Component` to component because: [incompatible-cast]
- Either property `current` is missing in function type [1] but exists in object type [2].
- Or undefined [1] is incompatible with null [3] in the first parameter.

function_lower.js:12:1
12| Component as component(ref: React.RefSetter<number>, ...Props); // Error
^^^^^^^^^ [1]
12| Component as component(ref: React.RefSetter<number>, ...Props); // Error
^^^^^^^^^

References:
function_lower.js:12:45
12| Component as component(ref: React.RefSetter<number>, ...Props); // Error
^^^^^^ [2]
function_lower.js:12:29
12| Component as component(ref: React.RefSetter<number>, ...Props); // Error
^^^^^^^^^^^^^^^^^^^^^^^ [1]
<BUILTINS>/react.js:196:5
196| | { -current: T | null, ... }
^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2]
<BUILTINS>/react.js:197:11
197| | ((T | null) => mixed)
^^^^ [3]


Error ------------------------------------------------------------------------------------------- function_lower.js:12:1

Cannot cast `Component` to component because: [incompatible-cast]
- Either undefined [1] is incompatible with null [2] in property `current`.
- Or a call signature declaring the expected parameter / return type is missing in object type [1] but exists in
function type [3].

function_lower.js:12:1
12| Component as component(ref: React.RefSetter<number>, ...Props); // Error
^^^^^^^^^

References:
function_lower.js:12:29
12| Component as component(ref: React.RefSetter<number>, ...Props); // Error
^^^^^^^^^^^^^^^^^^^^^^^ [1]
<BUILTINS>/react.js:196:21
196| | { -current: T | null, ... }
^^^^ [2]
<BUILTINS>/react.js:197:6
197| | ((T | null) => mixed)
^^^^^^^^^^^^^^^^^^^ [3]


Error ------------------------------------------------------------------------------------------ function_lower.js:17:10
Expand Down Expand Up @@ -718,16 +749,47 @@ References:

Error -------------------------------------------------------------------------------- function_to_component_type.js:8:1

Cannot cast `Foo` to component because undefined [1] is incompatible with string [2]. [incompatible-cast]
Cannot cast `Foo` to component because: [incompatible-cast]
- Either property `current` is missing in function type [1] but exists in object type [2].
- Or undefined [1] is incompatible with null [3] in the first parameter.

function_to_component_type.js:8:1
8| Foo as component( // error: void ~> string
^^^

References:
function_to_component_type.js:10:10
10| ref: React.RefSetter<string>
^^^^^^^^^^^^^^^^^^^^^^^ [1]
<BUILTINS>/react.js:196:5
196| | { -current: T | null, ... }
^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2]
<BUILTINS>/react.js:197:11
197| | ((T | null) => mixed)
^^^^ [3]


Error -------------------------------------------------------------------------------- function_to_component_type.js:8:1

Cannot cast `Foo` to component because: [incompatible-cast]
- Either undefined [1] is incompatible with null [2] in property `current`.
- Or a call signature declaring the expected parameter / return type is missing in object type [1] but exists in
function type [3].

function_to_component_type.js:8:1
8| Foo as component( // error: void ~> string
^^^ [1]
8| Foo as component( // error: void ~> string
^^^

References:
function_to_component_type.js:10:26
10| ref: React.RefSetter<string>
^^^^^^ [2]
function_to_component_type.js:10:10
10| ref: React.RefSetter<string>
^^^^^^^^^^^^^^^^^^^^^^^ [1]
<BUILTINS>/react.js:196:21
196| | { -current: T | null, ... }
^^^^ [2]
<BUILTINS>/react.js:197:6
197| | ((T | null) => mixed)
^^^^^^^^^^^^^^^^^^^ [3]


Error ------------------------------------------------------------------------------- function_to_component_type.js:12:1
Expand Down Expand Up @@ -1144,7 +1206,7 @@ expression. [signature-verification-failure]



Found 60 errors
Found 62 errors

Only showing the most relevant union/intersection branches.
To see all branches, re-run Flow with --show-all-branches

0 comments on commit 8e5ecac

Please sign in to comment.