Skip to content

Commit

Permalink
[flow][test] Add additional test for declare global {...} without e…
Browse files Browse the repository at this point in the history
…xplicit react import

Summary:
The added test helps to ensure that the globals can still be correctly used even when react is not imported. It helps to test the interaction between the declare global feature and the implicit inclusion of react import in file_sig.

Changelog: [internal]

Reviewed By: panagosg7

Differential Revision: D69133647

fbshipit-source-id: c13a169e64e14ce1bc35e8411413d372a231e88a
  • Loading branch information
SamChou19815 authored and facebook-github-bot committed Feb 5, 2025
1 parent 2f97af0 commit 4e239e3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,20 @@ References:
^^ [2]


Error ----------------------------------------------------------------------------- test_no_explicit_react_import.js:1:1

Found 7 errors
Cannot cast empty string to `MyReact` because string [1] is incompatible with string literal `react` [2].
[incompatible-cast]

test_no_explicit_react_import.js:1:1
1| '' as ReactTypes.MyReact; // error: '' ~> 'react'
^^ [1]

References:
test_no_explicit_react_import.js:1:7
1| '' as ReactTypes.MyReact; // error: '' ~> 'react'
^^^^^^^^^^^^^^^^^^ [2]



Found 8 errors
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
'' as ReactTypes.MyReact; // error: '' ~> 'react'

0 comments on commit 4e239e3

Please sign in to comment.