add types
This commit is contained in:
parent
6bb2549cfb
commit
17fdd50440
5
index.js
5
index.js
|
@ -1,10 +1,9 @@
|
||||||
const Browser = require('which-browser');
|
const Browser = require('which-browser');
|
||||||
// const express = require('express');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {express.Request} req
|
* @param {Express.Request} req
|
||||||
* @param {express.Response} res
|
* @param {Express.Response} res
|
||||||
* @param {*} next
|
* @param {*} next
|
||||||
*/
|
*/
|
||||||
function handler(req, res, next) {
|
function handler(req, res, next) {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Detect client's browser in Express.JS",
|
"description": "Detect client's browser in Express.JS",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
"types": "types.d.ts",
|
||||||
"author": "b1ek",
|
"author": "b1ek",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import WhichBrowser from "which-browser";
|
||||||
|
|
||||||
|
declare module "express-module" {
|
||||||
|
export default function(req: Express.Request, res: Express.Response, next: any);
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Express {
|
||||||
|
interface Request {
|
||||||
|
browser?: WhichBrowser
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue