@rsc-kit/core 0.45.1 → 0.45.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/vite.js CHANGED
@@ -2950,7 +2950,13 @@ function renderHostActions(module) {
2950
2950
  // form does not fill; any after the struct are left to the backend.
2951
2951
  const at = formParam(sig);
2952
2952
  const leading = at > 0 ? sig.params.slice(0, at).map((p, i) => "arg" + (i + 1) + ": " + tsOf(p)) : [];
2953
- lines.push(declare + name + "(" + [...leading, "form: " + formType(sig)].join(", ") + "): " + result + ";");
2953
+ // A plain <form action> takes a function returning void or
2954
+ // Promise<void>, and a stub resolves with a value - so one of these was
2955
+ // never a form's action, though it is called exactly as React calls one.
2956
+ // Also a Promise<void> for that check alone: awaited, the value is still
2957
+ // the method's. Not `async`: an async function's declared return must be
2958
+ // Promise<T> itself, and the intersection is not (TS1064).
2959
+ lines.push(declare.replace("async ", "") + name + "(" + [...leading, "form: " + formType(sig)].join(", ") + "): Promise<void> & " + result + ";");
2954
2960
  }
2955
2961
  lines.push(declare + name + "(...args: unknown[]) {");
2956
2962
  lines.push(" return await (globalThis as any)." +