Skip to content

Commit

Permalink
Cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
Shiva127 committed Oct 10, 2023
1 parent b639333 commit 17c50f8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
10 changes: 5 additions & 5 deletions types/index.d.ts
Expand Up @@ -9,10 +9,10 @@ declare module 'fastify' {

type FastifyEventBus = FastifyPluginCallback

declare namespace fastifySchedule {
export const fastifySchedule: FastifyEventBus
export { fastifySchedule as default }
declare namespace fastifyEventBus {
export const fastifyEventBus: FastifyEventBus
export { fastifyEventBus as default }
}

declare function fastifySchedule(): ReturnType<FastifyEventBus>
export = fastifySchedule
declare function fastifyEventBus(): ReturnType<FastifyEventBus>
export = fastifyEventBus
41 changes: 20 additions & 21 deletions types/index.test-d.ts
@@ -1,30 +1,29 @@
import { FastifyInstance, FastifyPluginCallback } from 'fastify'
import fastify from 'fastify'
import fastify, { FastifyInstance, FastifyPluginCallback } from 'fastify'
import { expectAssignable, expectType } from 'tsd'

import { fastifySchedule as fastifyScheduleNamed } from '.'
import fastifyScheduleDefault from '.'
import * as fastifyScheduleStar from '.'
import fastifyScheduleCjsImport = require('.')
const fastifyScheduleCjs = require('./')
import { fastifyEventBus as fastifyEventBusNamed } from '.'
import fastifyEventBusDefault from '.'
import * as fastifyEventBusStar from '.'
import fastifyEventBusCjsImport = require('.')
const fastifyEventBusCjs = require('./')

const app: FastifyInstance = fastify()

app.register(fastifyScheduleNamed)
app.register(fastifyScheduleDefault)
app.register(fastifyScheduleStar.default)
app.register(fastifyScheduleStar.fastifySchedule)
app.register(fastifyScheduleCjsImport.default)
app.register(fastifyScheduleCjsImport.fastifySchedule)
app.register(fastifyScheduleCjs)
app.register(fastifyEventBusNamed)
app.register(fastifyEventBusDefault)
app.register(fastifyEventBusStar.default)
app.register(fastifyEventBusStar.fastifyEventBus)
app.register(fastifyEventBusCjsImport.default)
app.register(fastifyEventBusCjsImport.fastifyEventBus)
app.register(fastifyEventBusCjs)

expectType<FastifyPluginCallback>(fastifyScheduleNamed)
expectType<FastifyPluginCallback>(fastifyScheduleDefault)
expectType<FastifyPluginCallback>(fastifyScheduleStar.default)
expectType<FastifyPluginCallback>(fastifyScheduleStar.fastifySchedule)
expectType<FastifyPluginCallback>(fastifyScheduleCjsImport.default)
expectType<FastifyPluginCallback>(fastifyScheduleCjsImport.fastifySchedule)
expectType<any>(fastifyScheduleCjs)
expectType<FastifyPluginCallback>(fastifyEventBusNamed)
expectType<FastifyPluginCallback>(fastifyEventBusDefault)
expectType<FastifyPluginCallback>(fastifyEventBusStar.default)
expectType<FastifyPluginCallback>(fastifyEventBusStar.fastifyEventBus)
expectType<FastifyPluginCallback>(fastifyEventBusCjsImport.default)
expectType<FastifyPluginCallback>(fastifyEventBusCjsImport.fastifyEventBus)
expectType<any>(fastifyEventBusCjs)

expectAssignable<Function>(app.eventBus.on)
expectAssignable<Function>(app.eventBus.once)
Expand Down

0 comments on commit 17c50f8

Please sign in to comment.