File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -20,11 +20,10 @@ declare module 'openapi-types' {
2020
2121declare module 'fastify' {
2222 interface FastifyInstance {
23- swagger : (
24- opts ?: {
25- yaml ?: boolean ;
26- }
27- ) => OpenAPI . Document ;
23+ swagger :
24+ ( ( opts ?: { yaml ?: false } ) => OpenAPI . Document ) &
25+ ( ( opts : { yaml : true } ) => string ) &
26+ ( ( opts : { yaml : boolean } ) => OpenAPI . Document | string ) ;
2827
2928 swaggerCSP : {
3029 script : string [ ] ;
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import fastifySwagger, {
66 FastifySwaggerUiHooksOptions , JSONObject ,
77} from "../.."
88import { minimalOpenApiV3Document } from './minimal-openapiV3-document' ;
9+ import { expectType } from "tsd" ;
10+ import { OpenAPI } from "openapi-types" ;
911
1012const app = fastify ( ) ;
1113const uiConfig : FastifySwaggerUiConfigOptions = {
@@ -227,3 +229,8 @@ app.register(fastifySwagger, {
227229. ready ( ( err ) => {
228230 app . swagger ( ) ;
229231} )
232+
233+ expectType < OpenAPI . Document > ( app . swagger ( ) )
234+ expectType < OpenAPI . Document > ( app . swagger ( { yaml : false } ) )
235+ expectType < string > ( app . swagger ( { yaml : true } ) )
236+ expectType < OpenAPI . Document | string > ( app . swagger ( { yaml : Boolean ( process . env . YAML ) } ) )
You can’t perform that action at this time.
0 commit comments