Repro for unexpected label as value block terminal
This was one of the last invariants firing internally, this PR adds a minimal repro and the next PR makes it a todo.
Joe Savona committed
Mar 13, 2024 at 22:20 UTC
d70b2c2c4e85c2a7061214c15a8ff13167d10422
2 files changed
+39
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-useMemo-with-optional.expect.md
new
+32
@@ -0,0 +1,32 @@
1
+
2
+## Input
3
+
4
+```javascript
5
+function Component(props) {
6
+ return (
7
+ useMemo(() => {
8
+ return [props.value];
9
+ }) || []
10
+ );
11
+}
12
+
13
+```
14
+
15
+
16
+## Error
17
+
18
+```
19
+ 1 | function Component(props) {
20
+ 2 | return (
21
+> 3 | useMemo(() => {
22
+ | ^^^^^^^^^^^^^^^
23
+> 4 | return [props.value];
24
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
25
+> 5 | }) || []
26
+ | ^^^^^^^^^^^^^ [ReactForget] Invariant: Unexpected value block terminal kind 'label' (3:5)
27
+ 6 | );
28
+ 7 | }
29
+ 8 |
30
+```
31
+
32
+
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-useMemo-with-optional.js
new
+7
@@ -0,0 +1,7 @@
1
+function Component(props) {
2
+ return (
3
+ useMemo(() => {
4
+ return [props.value];
5
+ }) || []
6
+ );
7
+}