Skip to content

Commit c35e0dc

Browse files
fix(platform): make fastify adapter generic
1 parent aadadc0 commit c35e0dc

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

packages/platform-fastify/adapters/fastify-adapter.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ import * as formBody from 'fastify-formbody';
99
import * as Reply from 'fastify/lib/reply';
1010
import * as pathToRegexp from 'path-to-regexp';
1111

12-
export class FastifyAdapter extends AbstractHttpAdapter {
12+
export class FastifyAdapter<TInstance> extends AbstractHttpAdapter {
1313
constructor(
1414
instanceOrOptions:
15-
| any
15+
| TInstance
1616
| fastify.ServerOptions
1717
| fastify.ServerOptionsAsHttp
1818
| fastify.ServerOptionsAsHttp2
1919
| fastify.ServerOptionsAsSecure
2020
| fastify.ServerOptionsAsSecureHttp
21-
| fastify.ServerOptionsAsSecureHttp2 = fastify(),
21+
| fastify.ServerOptionsAsSecureHttp2 = fastify() as any,
2222
) {
2323
const instance =
2424
instanceOrOptions &&
@@ -74,12 +74,12 @@ export class FastifyAdapter extends AbstractHttpAdapter {
7474
return this.instance.setNotFoundHandler(handler);
7575
}
7676

77-
public getHttpServer<T = any>(): T {
78-
return this.instance.server as T;
77+
public getHttpServer<TServer = any>(): TServer {
78+
return this.instance.server as TServer;
7979
}
8080

81-
public getInstance<T = any>(): T {
82-
return this.instance as T;
81+
public getInstance<TServer = any>(): TServer {
82+
return this.instance as TServer;
8383
}
8484

8585
public register(...args: any[]) {

0 commit comments

Comments
 (0)