Skip to content

Commit

Permalink
Merge pull request #211 from nicolasigot/master
Browse files Browse the repository at this point in the history
Update typings to export I18NextRequest instead of extending global express Request
  • Loading branch information
jamuhl authored Apr 19, 2020
2 parents 364be35 + 4e410eb commit a20950b
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import * as express from 'express';
import * as i18next from 'i18next';

declare global {
namespace Express {
interface Request {
language: string;
languages: string[];
i18n:i18next.i18n;
t:i18next.TFunction
}
}
}

declare module 'i18next-express-middleware' {
type I18next = i18next.i18n;
type IgnoreRoutesFunction = (req: express.Request, res: express.Response, options: HandleOptions, i18next: I18next) => boolean;
type App = express.Application | express.Router;

type I18NextRequest = express.Request & {
language: string;
languages: string[];
i18n:i18next.i18n;
t:i18next.TFunction;
}

interface HandleOptions {
ignoreRoutes?: string[] | IgnoreRoutesFunction;
removeLngFromUrl?: boolean;
Expand Down

0 comments on commit a20950b

Please sign in to comment.