Support Typescript
Closed this issue · 4 comments
yamatsum commented
Support Typescript
puchesjr commented
is the request for typescript support?
yamatsum commented
yes!
fa7ad commented
I don't know if you are planning a full-rewrite in typescript, but if you just want to add a .d.ts
file maybe this can help.
import { type FastifyPluginAsync } from 'fastify'
import { type app as firebaseApp } from 'firebase-admin'
type Firebase = firebaseApp.App
type FastifyFirebase =
FastifyPluginAsync<fastifyFirebase.FastifyFirebaseOptions>
declare namespace fastifyFirebase {
export interface FastifyFirebaseOptions {
name?: string
cert?: string
databaseURL?: string
storageBucket?: string
projectId?: string
}
export const fastifyFirebase: FastifyFirebase
export { fastifyFirebase as default }
}
declare module 'fastify' {
interface FastifyInstance {
firebase: Firebase
}
}
declare function fastifyFirebase(...params: Parameters<FastifyFirebase>): ReturnType<FastifyFirebase>
export = fastifyFirebase
I'm using this definition in one of my projects, the code is based on the type definition for fastify-helmet
iirc.
Cheers
puchesjr commented
Types have been added, please upgrade to v2.0.0-rc - will be going v2 in the coming weeks.