-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fastify 3.14.1 breaks fastify-websocket Typescript definitions #2967
Copy link
Copy link
Closed
Description
💥 Regression Report
With fastify 3.14.0 and fastify-websocket 3.1.0, one is able to write the following Typescript code to set up a web socket endpoint.
Last working version
Worked up to version: 3.14.0
Stopped working in version: 3.14.1
To Reproduce
Steps to reproduce the behavior:
const server = fastify()
server.register(require("fastify-websocket"))
server.get("/ws", {
websocket: true
},
createWSHandler())
}When tsc is run, this error is presented:
error TS2345: Argument of type '{ websocket: boolean; }' is not assignable to parameter of type 'RouteShorthandOptions<Server, IncomingMessage, ServerResponse, RouteGenericInterface, unknown, FastifySchema>'.
Object literal may only specify known properties, and 'websocket' does not exist in type 'RouteShorthandOptions<Server, IncomingMessage, ServerResponse, RouteGenericInterface, unknown, FastifySchema>'.
Expected behavior
tsc should omit no errors.
Your Environment
- node version: 12.21.0
- fastify version: >=3.14.1
- os: Mac 11.2.3
- Typescript 4.2.3
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels