jgouxJ
tRPCβ€’3y agoβ€’
13 replies
jgoux

No overload matches this call when outputting unions

Hello there πŸ‘‹,

I have this simple procedure (we're not fully migrated on v10 yet, using interop):

export const databaseValidateUrl = trpc
  .router<Context>()
  .query('database.validateUrl', {
    input: z.object({ url: z.string() }),
    resolve: ({ input: { url } }) => {
      const result = new ConnectionString(url)

      if (result.validationErrors) {
        return {
          success: false,
          validationErrors: result.validationErrors,
        }
      } else {
        return { success: true }
      }
    },
  })
Β 

TypeScript is complaining:
image.png
Was this page helpful?