Skip to content

Commit

Permalink
Merge pull request #16 from karlos1337/feat/typescript
Browse files Browse the repository at this point in the history
feat: typescript types
  • Loading branch information
beliven-emanuele-bertoldi authored Mar 23, 2024
2 parents d948e41 + 6221d64 commit 03cb46b
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 6 deletions.
21 changes: 21 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { FastifyPluginCallback } from 'fastify';
import { PathLike } from 'fs';
import Polyglot from 'node-polyglot';

declare module 'fastify' {
interface FastifyInstance {
i18n: Polyglot
}
}

declare namespace fastifyPolyglot {
export interface FastifyPolyglotOptions {
defaultLocale?: string
locales?: Record<string, PathLike>
localesPath?: string
}
}

type FastifyPolyglot = FastifyPluginCallback<fastifyPolyglot.FastifyPolyglotOptions>
declare function fastifyPolyglot(...params: Parameters<FastifyPolyglot>): ReturnType<FastifyPolyglot>
export = fastifyPolyglot
38 changes: 32 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
},
"homepage": "https://github.com/beliven-it/fastify-polyglot#readme",
"devDependencies": {
"@types/node": "^18.11.18",
"@types/node-polyglot": "^2.4.2",
"eslint": "^7.7.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.22.0",
Expand Down

0 comments on commit 03cb46b

Please sign in to comment.