Skip to content

Commit

Permalink
Add type test for extended RouteOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
kibertoad committed Mar 15, 2021
1 parent 255b1d4 commit 7f29c9e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/plugin.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fastify, { FastifyReply, FastifyRequest, RequestGenericInterface } from 'fastify'
import type { RouteOptions } from 'fastify/types/route'
import { expectType } from 'tsd'
import casbinRest from '../plugin'

Expand Down Expand Up @@ -62,3 +63,18 @@ server.get<ListRequest>('/', {
}
}
}, () => Promise.resolve('ok'))

const route: RouteOptions = {
method: 'GET',
url: '/',
handler: async () => {
},
casbin: {
rest: {
getSub: '1',
getObj: 'entity',
getAct: 'read'
}
}
}
server.route(route)

0 comments on commit 7f29c9e

Please sign in to comment.