jlalmes / trpc-openapi

OpenAPI support for tRPC 🧩
https://www.npmjs.com/package/trpc-openapi
MIT License
2.2k stars 150 forks source link

Types errors #322

Open nkouuu opened 1 year ago

nkouuu commented 1 year ago

When compiling I'm getting type errors on the MiddlewareResult union type. I was also getting type errors from the adapters, I guess because all of them are exported in index? but "skipLibCheck" solved that.

I've only imported OpenApiMeta.

import { OpenApiMeta } from "trpc-openapi";

Error

node_modules/@trpc/server/src/core/internals/procedureBuilder.ts:404:20 - error TS2339: Property 'error' does not exist on type 'MiddlewareResult<any>'.
  Property 'error' does not exist on type 'MiddlewareOKResult<any>'.

404       throw result.error;
                       ~~~~~

node_modules/@trpc/server/src/deprecated/internals/procedure.ts:244:20 - error TS2339: Property 'error' does not exist on type 'MiddlewareResult<any>'.
  Property 'error' does not exist on type 'MiddlewareOKResult<any>'.

244       throw result.error;
abanchev commented 1 year ago

Revert back to the old version (1.1.2) , the latest one introduces dependencies and one of them (not sure which) breaks something.

yangricardo commented 1 year ago

Also happened with me

AdarshHatkar commented 1 year ago

also happen with me and take much time to figure out 😅😅