Unverified Commit 2f3a503d authored by Shu Ding's avatar Shu Ding Committed by GitHub

Allow export decl with any init value in the actions compiler (#49600)

Because of the flexibility of export declarations, we can't know the
exact export type of exported values so we should allow all of them.
Especially when we already have runtime checks.
fix #49378
fix NEXT-1137
parent 2f9ff160
......@@ -717,13 +717,9 @@ impl<C: Comments> VisitMut for ServerActions<C> {
for decl in &mut var.decls {
if let Some(init) = &decl.init {
match &**init {
Expr::Fn(_f) => {}
Expr::Arrow(_a) => {}
Expr::Call(_c) => {}
_ => {
disallowed_export_span = *span;
}
if let Expr::Lit(_) = &**init {
// It's not allowed to export any literal.
disallowed_export_span = *span;
}
}
}
......
'use server'
export const { sampleFunction } = someObject
export const { sampleFunction2 } = fn()
export let { 0: sampleFunction3, 1: sampleFunction4 } = [g(), g()]
/* __next_internal_action_entry_do_not_use__ sampleFunction,sampleFunction2,sampleFunction3,sampleFunction4 */ import __create_action_proxy__ from "private-next-rsc-action-proxy";
import createServerReference from "private-next-rsc-action-client-wrapper";
export const sampleFunction = createServerReference("bd336abe00c3c59da66acb696fc8e151d8e54ea4");
export const sampleFunction2 = createServerReference("a0c73dd6f5af839e3335c6b19262ecb86cca6af4");
export const sampleFunction3 = createServerReference("d4f2e95bc745b6500b439c0847003511748c8ece");
export const sampleFunction4 = createServerReference("f03b256ee88a51700367acee3082894e25e6e7d9");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment