mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Allow typing Express body, params, query and cookies through generics (#20820)
* Allow typing express body, params, query and cookies through generics * Increase minor version * Add ts version comment * Fix ts requirement comment typo * Bump all ts version packages * Bump Morgan package
This commit is contained in:
1
types/body-parser/index.d.ts
vendored
1
types/body-parser/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/expressjs/body-parser
|
||||
// Definitions by: Santi Albo <https://github.com/santialbo>, Vilic Vane <https://github.com/vilic>, Jonathan Häberle <https://github.com/dreampulse>, Gevik Babakhani <https://github.com/blendsdk>, Tomasz Łaziuk <https://github.com/tlaziuk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
|
||||
2
types/documentdb-session/index.d.ts
vendored
2
types/documentdb-session/index.d.ts
vendored
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/dwhieb/documentdb-session#readme
|
||||
// Definitions by: Daniel Rosenwasser <https://github.com/DanielRosenwasser>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import session = require("express-session");
|
||||
|
||||
|
||||
2
types/egg/index.d.ts
vendored
2
types/egg/index.d.ts
vendored
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/eggjs/egg
|
||||
// Definitions by: Eward Song <https://github.com/sheperdwind>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as accepts from 'accepts';
|
||||
import * as KoaApplication from 'koa';
|
||||
|
||||
1
types/express-brute-redis/index.d.ts
vendored
1
types/express-brute-redis/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/AdamPflug/express-brute-redis
|
||||
// Definitions by: Scott Harwell <https://github.com/scottharwell>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { ClientOpts } from "redis";
|
||||
|
||||
|
||||
1
types/express-enforces-ssl/index.d.ts
vendored
1
types/express-enforces-ssl/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/aredo/express-enforces-ssl
|
||||
// Definitions by: Kevin Stubbs <https://github.com/kevinstubbs>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Request, Response, NextFunction } from 'express';
|
||||
|
||||
|
||||
1
types/express-mongo-sanitize/index.d.ts
vendored
1
types/express-mongo-sanitize/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/fiznool/express-mongo-sanitize#readme
|
||||
// Definitions by: Eric Byers <https://github.com/ericbyers>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import express = require('express');
|
||||
|
||||
|
||||
1
types/express-rate-limit/index.d.ts
vendored
1
types/express-rate-limit/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/nfriedly/express-rate-limit
|
||||
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>, makepost <https://github.com/makepost>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import express = require("express");
|
||||
|
||||
|
||||
1
types/express-sanitized/index.d.ts
vendored
1
types/express-sanitized/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/askhogan/express-sanitized
|
||||
// Definitions by: Chris Barth <https://github.com/cjbarth>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as express from "express";
|
||||
|
||||
|
||||
15
types/express-serve-static-core/index.d.ts
vendored
15
types/express-serve-static-core/index.d.ts
vendored
@@ -174,7 +174,12 @@ interface RequestRanges extends Array<ByteRange> { type: string; }
|
||||
|
||||
interface Errback { (err: Error): void; }
|
||||
|
||||
interface Request extends http.IncomingMessage, Express.Request {
|
||||
interface Request<
|
||||
Body = any,
|
||||
Query = any,
|
||||
Params = any,
|
||||
Cookies = any
|
||||
> extends http.IncomingMessage, Express.Request {
|
||||
|
||||
/**
|
||||
* Return request header.
|
||||
@@ -435,14 +440,14 @@ interface Request extends http.IncomingMessage, Express.Request {
|
||||
xhr: boolean;
|
||||
|
||||
//body: { username: string; password: string; remember: boolean; title: string; };
|
||||
body: any;
|
||||
body: Body;
|
||||
|
||||
//cookies: { string; remember: boolean; };
|
||||
cookies: any;
|
||||
cookies: Cookies;
|
||||
|
||||
method: string;
|
||||
|
||||
params: any;
|
||||
params: Params;
|
||||
|
||||
/**
|
||||
* Clear cookie `name`.
|
||||
@@ -452,7 +457,7 @@ interface Request extends http.IncomingMessage, Express.Request {
|
||||
*/
|
||||
clearCookie(name: string, options?: any): Response;
|
||||
|
||||
query: any;
|
||||
query: Query;
|
||||
|
||||
route: any;
|
||||
|
||||
|
||||
1
types/express-session/index.d.ts
vendored
1
types/express-session/index.d.ts
vendored
@@ -3,6 +3,7 @@
|
||||
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// Definitions by: Jacob Bogers <https://github.com/jacobbogers
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
|
||||
@@ -17,9 +17,10 @@ namespace express_tests {
|
||||
next();
|
||||
});
|
||||
|
||||
app.use((err: any, req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||
console.error(err);
|
||||
next(err);
|
||||
app.use((err: any, req: express.Request<{ hello: string; }>, res: express.Response, next: express.NextFunction) => {
|
||||
console.log(req.body.hello);
|
||||
console.error(err);
|
||||
next(err);
|
||||
});
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
|
||||
9
types/express/index.d.ts
vendored
9
types/express/index.d.ts
vendored
@@ -2,7 +2,7 @@
|
||||
// Project: http://expressjs.com
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/* =================== USAGE ===================
|
||||
|
||||
@@ -76,7 +76,12 @@ declare namespace e {
|
||||
interface IRouterMatcher<T> extends core.IRouterMatcher<T> { }
|
||||
interface MediaType extends core.MediaType { }
|
||||
interface NextFunction extends core.NextFunction { }
|
||||
interface Request extends core.Request { }
|
||||
interface Request<
|
||||
Body = any,
|
||||
Query = any,
|
||||
Params = any,
|
||||
Cookies = any
|
||||
> extends core.Request<Body, Query, Params, Cookies> { }
|
||||
interface RequestHandler extends core.RequestHandler { }
|
||||
interface RequestParamHandler extends core.RequestParamHandler { }
|
||||
export interface Response extends core.Response { }
|
||||
|
||||
1
types/i18n/index.d.ts
vendored
1
types/i18n/index.d.ts
vendored
@@ -3,6 +3,7 @@
|
||||
// Definitions by: Maxime LUCE <https://github.com/SomaticIT>
|
||||
// FindQ <https://github.com/FindQ>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
declare namespace i18n {
|
||||
interface ConfigurationOptions {
|
||||
|
||||
2
types/koa-morgan/index.d.ts
vendored
2
types/koa-morgan/index.d.ts
vendored
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/koa-modules/morgan
|
||||
// Definitions by: Vesa Poikajärvi <https://github.com/vesse>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { IncomingMessage, ServerResponse } from 'http';
|
||||
import * as Koa from 'koa';
|
||||
|
||||
2
types/morgan/index.d.ts
vendored
2
types/morgan/index.d.ts
vendored
@@ -3,7 +3,7 @@
|
||||
// Definitions by: James Roland Cabresos <https://github.com/staticfunction>
|
||||
// Paolo Scanferla <https://github.com/pscanf>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import express = require('express');
|
||||
|
||||
|
||||
2
types/multer/index.d.ts
vendored
2
types/multer/index.d.ts
vendored
@@ -6,7 +6,7 @@
|
||||
// Michael Ledin <https://github.com/mxl>
|
||||
// HyunSeob Lee <https://github.com/hyunseob>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as express from 'express';
|
||||
|
||||
|
||||
1
types/node-common-errors/index.d.ts
vendored
1
types/node-common-errors/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/shutterstock/node-errors
|
||||
// Definitions by: Ian Copp <https://github.com/icopp>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as express from 'express';
|
||||
|
||||
|
||||
1
types/node-ral/index.d.ts
vendored
1
types/node-ral/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/fex-team/node-ral
|
||||
// Definitions by: ssddi456 <https://github.com/ssddi456>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { EventEmitter } from 'events';
|
||||
import { Request, Response, NextFunction } from "express";
|
||||
|
||||
1
types/oauth2-server/index.d.ts
vendored
1
types/oauth2-server/index.d.ts
vendored
@@ -3,6 +3,7 @@
|
||||
// Definitions by: Robbie Van Gorkom <https://github.com/vangorra>,
|
||||
// Charles Irick <https://github.com/cirick>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Request, RequestHandler } from "express";
|
||||
|
||||
|
||||
1
types/optics-agent/index.d.ts
vendored
1
types/optics-agent/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/apollostack/optics-agent-js#readme
|
||||
// Definitions by: Crevil <https://github.com/crevil>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { GraphQLSchema } from "graphql";
|
||||
import { Request, Response } from "express";
|
||||
|
||||
2
types/passport-client-cert/index.d.ts
vendored
2
types/passport-client-cert/index.d.ts
vendored
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/ripjar/passport-client-cert
|
||||
// Definitions by: Sean Warner <https://github.com/warnersean>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Strategy as PassportStrategy } from 'passport-strategy';
|
||||
import { Request } from 'express';
|
||||
|
||||
2
types/passport-discord/index.d.ts
vendored
2
types/passport-discord/index.d.ts
vendored
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/nicholastay/passport-discord#readme
|
||||
// Definitions by: Gonthier Renaud <https://github.com/kzay>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
/** Declaration file generated by dts-gen */
|
||||
|
||||
import * as passport from 'passport';
|
||||
|
||||
2
types/passport-facebook/index.d.ts
vendored
2
types/passport-facebook/index.d.ts
vendored
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/jaredhanson/passport-facebook
|
||||
// Definitions by: James Roland Cabresos <https://github.com/staticfunction>, Lucas Acosta <https://github.com/lucasmacosta>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import passport = require('passport');
|
||||
import express = require('express');
|
||||
|
||||
2
types/passport-github/index.d.ts
vendored
2
types/passport-github/index.d.ts
vendored
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/jaredhanson/passport-github
|
||||
// Definitions by: Yasunori Ohoka <https://github.com/yasupeke>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import passport = require('passport');
|
||||
import express = require('express');
|
||||
|
||||
2
types/passport-github2/index.d.ts
vendored
2
types/passport-github2/index.d.ts
vendored
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Yasunori Ohoka <https://github.com/yasupeke>
|
||||
// Maarten Mulders <https://github.com/mthmulders>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import passport = require('passport');
|
||||
import express = require('express');
|
||||
|
||||
2
types/passport-oauth2/index.d.ts
vendored
2
types/passport-oauth2/index.d.ts
vendored
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/jaredhanson/passport-oauth2#readme
|
||||
// Definitions by: Pasi Eronen <https://github.com/pasieronen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Request } from 'express';
|
||||
import { Strategy } from 'passport';
|
||||
|
||||
1
types/passport-saml/index.d.ts
vendored
1
types/passport-saml/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/bergie/passport-saml
|
||||
// Definitions by: Chris Barth <https://github.com/cjbarth>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import passport = require('passport');
|
||||
import express = require('express');
|
||||
|
||||
2
types/passport-unique-token/index.d.ts
vendored
2
types/passport-unique-token/index.d.ts
vendored
@@ -3,7 +3,7 @@
|
||||
// Definitions by: briman0094 <https://github.com/briman0094>
|
||||
// Maxime LUCE <https://github.com/SomaticIT>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import passport = require('passport');
|
||||
import express = require('express');
|
||||
|
||||
2
types/swagger-node-runner/index.d.ts
vendored
2
types/swagger-node-runner/index.d.ts
vendored
@@ -2,7 +2,7 @@
|
||||
// Project: https://www.npmjs.com/package/swagger-node-runner
|
||||
// Definitions by: Michael Mrowetz <https://github.com/micmro>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/* =================== USAGE ===================
|
||||
|
||||
|
||||
2
types/yog-log/index.d.ts
vendored
2
types/yog-log/index.d.ts
vendored
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/fex-team/yog-log
|
||||
// Definitions by: ssddi456 <https://github.com/ssddi456>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Request, Response, NextFunction } from "express";
|
||||
|
||||
|
||||
1
types/yog2-kernel/index.d.ts
vendored
1
types/yog2-kernel/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/fex-team/yog2-kernel
|
||||
// Definitions by: ssddi456 <https://github.com/ssddi456>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as express from "express";
|
||||
import * as _ from "lodash";
|
||||
|
||||
Reference in New Issue
Block a user