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
In order to make the development experience better in service workers, it would be useful if the generated endpoint modules contained explicit exports for the method signatures' types. This would allow typesafe development for method calls in service worker code.
Describe the solution you'd like
An endpoint method signature contains a name, 0...n input arguments, and a return type. The generated modules could export a list of TypeScript signature types that contain this information which could be safely imported by a service worker.
Like in #2788 , the signature generation could be optional and configurable.
A longer-term solution could be transparent service worker call support in endpoints; not sure what that would look like exactly.
Additional context
Currently generated endpoint TS modules can't be imported in a service worker, as the Flux dependency breaks the TS build. Presumably, this wouldn't be an issue for exporting only the signature types.
Flux error when importing in sw.ts:
RollupError: node_modules/@vaadin/hilla-frontend/FluxConnection.js (1:7): "default" is not exported by "node_modules/atmosphere.js/lib/browser.js", imported by "node_modules/@vaadin/hilla-frontend/FluxConnection.js".
at getRollupError (file:///app/node_modules/rollup/dist/es/shared/parseAst.js:396:41)
at error (file:///app/node_modules/rollup/dist/es/shared/parseAst.js:392:42)
at Module.error (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:13858:16)
at Module.traceVariable (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:14306:29)
at ModuleScope.findVariable (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:11984:39)
at ChildScope.findVariable (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:7432:38)
at ClassBodyScope.findVariable (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:7432:38)
at ChildScope.findVariable (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:7432:38)
at ChildScope.findVariable (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:7432:38)
at FunctionScope.findVariable (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:7432:38)
The text was updated successfully, but these errors were encountered:
Describe your motivation
Related issue: #2788
In order to make the development experience better in service workers, it would be useful if the generated endpoint modules contained explicit exports for the method signatures' types. This would allow typesafe development for method calls in service worker code.
Describe the solution you'd like
An endpoint method signature contains a name, 0...n input arguments, and a return type. The generated modules could export a list of TypeScript signature types that contain this information which could be safely imported by a service worker.
Pseudo-code example
Describe alternatives you've considered
Like in #2788 , the signature generation could be optional and configurable.
A longer-term solution could be transparent service worker call support in endpoints; not sure what that would look like exactly.
Additional context
Currently generated endpoint TS modules can't be imported in a service worker, as the Flux dependency breaks the TS build. Presumably, this wouldn't be an issue for exporting only the signature types.
Flux error when importing in sw.ts:
The text was updated successfully, but these errors were encountered: