mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
[compiler] Handle TSInstantiationExpression in lowerExpression (#32302)
Fix #31745
This commit is contained in:
parent
a4b2d0d518
commit
10a4c88f58
|
|
@ -2528,6 +2528,7 @@ function lowerExpression(
|
|||
loc: expr.node.loc ?? GeneratedSource,
|
||||
};
|
||||
}
|
||||
case 'TSInstantiationExpression':
|
||||
case 'TSNonNullExpression': {
|
||||
let expr = exprPath as NodePath<t.TSNonNullExpression>;
|
||||
return lowerExpression(builder, expr.get('expression'));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
|
||||
## Input
|
||||
|
||||
```javascript
|
||||
import {identity, invoke} from 'shared-runtime';
|
||||
|
||||
function Test() {
|
||||
const str = invoke(identity<string>, 'test');
|
||||
return str;
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Test,
|
||||
params: [],
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
## Code
|
||||
|
||||
```javascript
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import { identity, invoke } from "shared-runtime";
|
||||
|
||||
function Test() {
|
||||
const $ = _c(1);
|
||||
let t0;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t0 = invoke(identity, "test");
|
||||
$[0] = t0;
|
||||
} else {
|
||||
t0 = $[0];
|
||||
}
|
||||
const str = t0;
|
||||
return str;
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Test,
|
||||
params: [],
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
### Eval output
|
||||
(kind: ok) "test"
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
import {identity, invoke} from 'shared-runtime';
|
||||
|
||||
function Test() {
|
||||
const str = invoke(identity<string>, 'test');
|
||||
return str;
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Test,
|
||||
params: [],
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user