Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Make serializeService work with services that don't throw #31

Merged
merged 2 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@replit/river",
"sideEffects": false,
"description": "It's like tRPC but... with JSON Schema Support, duplex streaming and support for service multiplexing. Transport agnostic!",
"version": "0.9.0",
"version": "0.9.1",
"type": "module",
"exports": {
".": "./dist/router/index.js",
Expand Down
7 changes: 6 additions & 1 deletion router/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ export function serializeService(s: AnyService): object {
{
input: Type.Strict(procDef.input),
output: Type.Strict(procDef.output),
errors: Type.Strict(procDef.errors),
// Only add the `errors` field if it is non-never.
...('errors' in procDef
? {
errors: Type.Strict(procDef.errors),
}
: {}),
type: procDef.type,
// Only add the `init` field if the type declares it.
...('init' in procDef
Expand Down