acronie
acronie11mo ago

WS with TRPC

│  Type '({ req, res, }: { req: Request; res: Response; }) => CreateInnerContextOpts' is not assignable to type 'NodeHTTPCreateContextFn<CreateRouterInner<RootConfig<{ ctx: CreateInnerContextOpts; meta: object; errorShape: { data: { zodError: typeToFlattenedError<any, string> | null; code: "PARSE_ERROR" | ... 13 more ... | "CLIENT_CLOSED_REQUEST"; httpStatus: number; path?: string | undefined; stack?: string | undefined; }; me...'. typescript (2322) [12, 3]
│ Types of parameters '__0' and 'opts' are incompatible.
│ Type 'NodeHTTPCreateContextFnOptions<IncomingMessage, WebSocket>' is not assignable to type '{ req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>; res: Response<any, Record<string, any>>; }'.
│ Types of property 'req' are incompatible.
│ Type 'IncomingMessage' is missing the following properties from type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>': get, header, accepts, acceptsCharsets, and 26 more.
│  Type '({ req, res, }: { req: Request; res: Response; }) => CreateInnerContextOpts' is not assignable to type 'NodeHTTPCreateContextFn<CreateRouterInner<RootConfig<{ ctx: CreateInnerContextOpts; meta: object; errorShape: { data: { zodError: typeToFlattenedError<any, string> | null; code: "PARSE_ERROR" | ... 13 more ... | "CLIENT_CLOSED_REQUEST"; httpStatus: number; path?: string | undefined; stack?: string | undefined; }; me...'. typescript (2322) [12, 3]
│ Types of parameters '__0' and 'opts' are incompatible.
│ Type 'NodeHTTPCreateContextFnOptions<IncomingMessage, WebSocket>' is not assignable to type '{ req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>; res: Response<any, Record<string, any>>; }'.
│ Types of property 'req' are incompatible.
│ Type 'IncomingMessage' is missing the following properties from type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>': get, header, accepts, acceptsCharsets, and 26 more.
does anyone know how can I fix this and make it compatible with my opts?
4 Replies
acronie
acronie11mo ago
I am using express adapter Also I have a doubt I just see yk a way to subscribe to updates? But not a way to emit an event from the client? is there some catch here
marcos daniel
marcos daniel11mo ago
getting the same error, would like to know the answer as well
acronie
acronie11mo ago
@marcos daniel have you figured out how you would emit events from the client? which go on as websocket event and not http request then emitting inside the mutation
marcos daniel
marcos daniel11mo ago
I have no idea, im new to all this, but I dont know why you would want that, just send a plain http mutation