You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exporting type definitions from a (top level) "use server" file like this
'use server';exporttypeInput=number;exportasyncfunctionworld2(x: Input){console.log('hello world 2',x);}
will produce the following error in development
[h3] [unhandled] H3Error: undefined does not match field "params": [Pattern] of type FunctionExpression
at addParam (/home/projects/github-7jpzac/node_modules/ast-types/lib/types.js:455:27)
... 7 lines matching cause stack trace ...
at async instantiateModule (/home/projects/github-7jpzac/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:56003:10) {
cause: Error: undefined does not match field "params": [Pattern] of type FunctionExpression
at addParam (/home/projects/github-7jpzac/node_modules/ast-types/lib/types.js:455:27)
at eval (/home/projects/github-7jpzac/node_modules/ast-types/lib/types.js:505:25)
at builder.from (/home/projects/github-7jpzac/node_modules/ast-types/lib/types.js:503:46)
at wrapExports (/home/projects/github-7jpzac/node_modules/@vinxi/plugin-directives/plugins/wrap-exports.js:392:53)
at Object.transform (/home/projects/github-7jpzac/node_modules/@vinxi/plugin-directives/plugins/wrap-exports.js:57:24)
at TransformContext.transform (/home/projects/github-7jpzac/node_modules/@vinxi/plugin-directives/plugin.js:62:29)
at Object.transform (/home/projects/github-7jpzac/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:44404:62)
at async loadAndTransform (/home/projects/github-7jpzac/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:55078:29)
at async instantiateModule (/home/projects/github-7jpzac/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:56003:10) {
plugin: 'vite-server-references',
id: '/home/projects/github-7jpzac/app/inline.tsx',
pluginCode: "'use server';\n" +
'\n' +
'export type Input = number;\n' +
'export async function world2(x: Input) {\n' +
" console.log('hello world 2', x);\n" +
'}\n'
},
statusCode: 500,
fatal: false,
unhandled: true,
statusMessage: undefined,
data: undefined
}
When I remove the export for the Input type, it works as expected.
The text was updated successfully, but these errors were encountered:
Exporting type definitions from a (top level) "use server" file like this
will produce the following error in development
When I remove the
export
for theInput
type, it works as expected.The text was updated successfully, but these errors were encountered: