fastify / fastify-websocket

basic websocket support for fastify
MIT License
394 stars 72 forks source link

typebox typings tests fail #270

Closed Uzlopak closed 8 months ago

Uzlopak commented 11 months ago

Prerequisites

Issue

> @fastify/websocket@8.2.0 test:typescript
> tsd

  types/index.test-d.ts:166:152
  ✖  166:152  Argument of type FastifyRequest<RequestGenericInterface, RawServerDefault, IncomingMessage, { params: TObject<{ foo: TString; }>; querystring: TObject<...>; body: TObject<...>; headers: TObject<...>; }, TypeBoxTypeProvider, unknown, FastifyBaseLogger, ResolveFastifyRequestType<...>> is not assignable to parameter of type FastifyRequest<RequestGenericInterface, RawServerDefault, IncomingMessage, SchemaType, TypeBoxTypeProvider, unknown, FastifyBaseLogger, ResolveFastifyRequestType<...>>.
  Type { params: TObject<{ foo: TString; }>; querystring: TObject<{ search: TString; }>; body: TObject<{ bar: TString; }>; headers: TObject<{ auth: TString; }>; } is not assignable to type SchemaType.
    Types of property params are incompatible.
      Property foo is missing in type TObject<{ foo: TString; }> but required in type { foo: string; }.  
  ✖  180:236  Argument of type FastifyRequest<RouteGenericInterface, RawServerDefault, IncomingMessage, { params: TObject<{ foo: TString; }>; querystring: TObject<...>; body: TObject<...>; headers: TObject<...>; }, TypeBoxTypeProvider, unknown, FastifyBaseLogger, ResolveFastifyRequestType<...>> is not assignable to parameter of type FastifyRequest<RouteGenericInterface, RawServerDefault, IncomingMessage, SchemaType, TypeBoxTypeProvider, unknown, FastifyBaseLogger, ResolveFastifyRequestType<...>>.
  Type { params: TObject<{ foo: TString; }>; querystring: TObject<{ search: TString; }>; body: TObject<{ bar: TString; }>; headers: TObject<{ auth: TString; }>; } is not assignable to type SchemaType.                                                                                                                                                           
  ✖  181:181  Argument of type FastifyReply<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, RouteGenericInterface, unknown, { ...; }, TypeBoxTypeProvider, unknown> is not assignable to parameter of type FastifyReply<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, RouteGenericInterface, unknown, SchemaType, TypeBoxTypeProvider, unknown>.
  Type { params: TObject<{ foo: TString; }>; querystring: TObject<{ search: TString; }>; body: TObject<{ bar: TString; }>; headers: TObject<{ auth: TString; }>; } is not assignable to type SchemaType.                                                                                                                                                                                                    

@sinclair

Any hints why query is not resolved correctly?

Fdawgs commented 10 months ago

Wrong Sinclair. @sinclairzx81