Skip to content

Commit

Permalink
add shorthand types (#5455)
Browse files Browse the repository at this point in the history
  • Loading branch information
gurgunday committed May 9, 2024
1 parent 0bf9506 commit 8817f52
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/types/route.test-d.ts
Expand Up @@ -38,10 +38,10 @@ const routeHandlerWithReturnValue: RouteHandlerMethod = function (request, reply

type LowerCaseHTTPMethods = 'delete' | 'get' | 'head' | 'patch' | 'post' | 'put' |
'options' | 'propfind' | 'proppatch' | 'mkcol' | 'copy' | 'move' | 'lock' |
'unlock' | 'trace' | 'search'
'unlock' | 'trace' | 'search' | 'mkcalendar' | 'report'

;['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT', 'OPTIONS', 'PROPFIND',
'PROPPATCH', 'MKCOL', 'COPY', 'MOVE', 'LOCK', 'UNLOCK', 'TRACE', 'SEARCH'
'PROPPATCH', 'MKCOL', 'COPY', 'MOVE', 'LOCK', 'UNLOCK', 'TRACE', 'SEARCH', 'MKCALENDAR', 'REPORT'
].forEach(method => {
// route method
expectType<FastifyInstance>(fastify().route({
Expand Down
2 changes: 2 additions & 0 deletions types/instance.d.ts
Expand Up @@ -189,12 +189,14 @@ export interface FastifyInstance<
options: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
propfind: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
proppatch: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
mkcalendar: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
mkcol: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
copy: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
move: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
lock: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
unlock: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
trace: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
report: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
search: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;
all: RouteShorthandMethod<RawServer, RawRequest, RawReply, TypeProvider, Logger>;

Expand Down

0 comments on commit 8817f52

Please sign in to comment.