Test case for Array.push on frozen array

Just making sure that we reject this
This commit is contained in:
Joe Savona
2023-05-25 16:00:35 -07:00
parent 3381ce7ea8
commit edbb6e2bdb
2 changed files with 27 additions and 0 deletions
@@ -0,0 +1,21 @@
## Input
```javascript
function Component(props) {
const x = [];
<div>{x}</div>;
x.push(props.value);
return x;
}
```
## Error
```
[ReactForget] InvalidInput: InferReferenceEffects: inferred mutation of known immutable value. Found mutation of $20:TObject<BuiltInArray> (frozen) (4:4)
```
@@ -0,0 +1,6 @@
function Component(props) {
const x = [];
<div>{x}</div>;
x.push(props.value);
return x;
}