Skip to content

Commit a442a18

Browse files
authored
fix missing opts.url typing (#56)
* fix missing opts.url typing * extends with Intersection types * test types
1 parent e4a83a2 commit a442a18

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ declare module 'fastify' {
77
}
88
}
99

10-
export type FastifyRedisPlugin = RedisOptions | { client: Redis }
10+
export type FastifyRedisPlugin = RedisOptions & { url?: string } | { client: Redis }
1111

1212
declare const fastifyRedis: FastifyPlugin<FastifyRedisPlugin>;
1313

test/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const redis = new IORedis({ host: 'localhost', port: 6379 });
77

88
app.register(fastifyRedis, { host: '127.0.0.1' });
99
app.register(fastifyRedis, { client: redis });
10+
app.register(fastifyRedis, { url: 'redis://127.0.0.1:6379', keepAlive: 0 });
1011

1112
app.get('/foo', (req: FastifyRequest, reply) => {
1213
const { redis } = app;

0 commit comments

Comments
 (0)