Skip to content

Commit 842dc13

Browse files
audothomasRafaelGSS
authored andcommitted
fix: add type support for instance has plugin
1 parent 6f4842d commit 842dc13

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

test/types/instance.test-d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ const versionConstraintStrategy = {
326326
expectType<void>(server.addConstraintStrategy(versionConstraintStrategy))
327327
expectType<boolean>(server.hasConstraintStrategy(versionConstraintStrategy.name))
328328

329+
expectType<boolean>(server.hasPlugin(''))
330+
329331
expectAssignable<DefaultRoute<RawRequestDefaultExpression, RawReplyDefaultExpression>>(server.getDefaultRoute())
330332

331333
expectType<FastifySchemaCompiler<any> | undefined>(server.validatorCompiler)

types/instance.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ export interface FastifyInstance<
131131
hasDecorator(decorator: string | symbol): boolean;
132132
hasRequestDecorator(decorator: string | symbol): boolean;
133133
hasReplyDecorator(decorator: string | symbol): boolean;
134+
hasPlugin(name: string): boolean;
134135

135136
addConstraintStrategy(strategy: ConstraintStrategy<FindMyWayVersion<RawServer>, unknown>): void;
136137
hasConstraintStrategy(strategyName: string): boolean;

0 commit comments

Comments
 (0)