|
1 | 1 | import { TypeBoxTypeProvider } from '@fastify/type-provider-typebox' |
2 | | -import { Type } from 'typebox' |
| 2 | +import { Type } from '@sinclair/typebox' |
3 | 3 | import fastify, { FastifyBaseLogger, FastifyInstance, FastifyReply, FastifyRequest, FastifySchema, RawRequestDefaultExpression, RawServerDefault, RequestGenericInterface, RouteOptions } from 'fastify' |
4 | 4 | import { RouteGenericInterface } from 'fastify/types/route' |
5 | 5 | import type { IncomingMessage } from 'node:http' |
6 | 6 | import { expectType } from 'tsd' |
7 | 7 | import { Server } from 'ws' |
8 | | -// eslint-disable-next-line import-x/no-named-default -- Test default export |
9 | | -import fastifyWebsocket, { default as defaultFastifyWebsocket, fastifyWebsocket as namedFastifyWebsocket, WebSocket, WebsocketHandler } from '..' |
| 8 | +import defaultFastifyWebsocket, { |
| 9 | + fastifyWebsocket as namedFastifyWebsocket, |
| 10 | + WebSocket, |
| 11 | + WebsocketHandler |
| 12 | +} from '..' |
10 | 13 |
|
| 14 | +const fastifyWebsocket = defaultFastifyWebsocket |
11 | 15 | const app: FastifyInstance = fastify() |
12 | 16 | app.register(fastifyWebsocket) |
13 | 17 | app.register(fastifyWebsocket, {}) |
@@ -111,22 +115,18 @@ app.route<{ Params: { foo: string }, Body: { bar: string }, Querystring: { searc |
111 | 115 | }) |
112 | 116 |
|
113 | 117 | const schema = { |
114 | | - params: Type.Object( |
115 | | - { foo: Type.String() }, |
116 | | - { required: ['foo'] } |
117 | | - ), |
118 | | - querystring: Type.Object( |
119 | | - { search: Type.String() }, |
120 | | - { required: ['search'] } |
121 | | - ), |
122 | | - body: Type.Object( |
123 | | - { bar: Type.String() }, |
124 | | - { required: ['bar'] } |
125 | | - ), |
126 | | - headers: Type.Object( |
127 | | - { auth: Type.String() }, |
128 | | - { required: ['auth'] } |
129 | | - ) |
| 118 | + params: Type.Object({ |
| 119 | + foo: Type.String() |
| 120 | + }), |
| 121 | + querystring: Type.Object({ |
| 122 | + search: Type.String() |
| 123 | + }), |
| 124 | + body: Type.Object({ |
| 125 | + bar: Type.String() |
| 126 | + }), |
| 127 | + headers: Type.Object({ |
| 128 | + auth: Type.String() |
| 129 | + }) |
130 | 130 | } |
131 | 131 |
|
132 | 132 | const server = app.withTypeProvider<TypeBoxTypeProvider>() |
|
0 commit comments