Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

express-serve-static-core: Restore compatibility with ts2.1 #21044

Merged
merged 1 commit into from Oct 26, 2017

Conversation

@andy-ms
Copy link
Contributor

commented Oct 26, 2017

Fixes #20820 (comment)

Reverts express-serve-static-core and its dependent packages to compatibility with TypeScript 2.1 by removing type parameters from Request. A specifically-typed Request can still be obtained by extending the interface and overriding properties.

Also reverts // TypeScript Version comments of popular packages so that any future incompatities will be more noticeable.

@dt-bot

This comment has been minimized.

Copy link
Member

commented Oct 26, 2017

types/express-serve-static-core/index.d.ts

to authors (@borisyankov @19majkel94 @kacepe). Could you review this PR?
👍 or 👎?


types/express/index.d.ts

to author (@borisyankov). Could you review this PR?
👍 or 👎?

@andy-ms andy-ms requested a review from borisyankov as a code owner Oct 26, 2017
@andy-ms andy-ms force-pushed the express-serve-static-core_ts2.1 branch from a4b0b13 to d8f8f82 Oct 26, 2017
@andy-ms andy-ms requested a review from horiuchi as a code owner Oct 26, 2017
@andy-ms

This comment has been minimized.

Copy link
Contributor Author

commented Oct 26, 2017

Test failure fixed by #21045

@andy-ms andy-ms merged commit 5761cfc into master Oct 26, 2017
0 of 2 checks passed
0 of 2 checks passed
continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/travis-ci/push The Travis CI build failed
Details
@andy-ms andy-ms deleted the express-serve-static-core_ts2.1 branch Oct 26, 2017
@rhyek

This comment has been minimized.

Copy link

commented Dec 24, 2017

@andy-ms i'm having an issue with express@4.16.2; express-serve-static-core@4.11.0; typescript@2.6.1. I get node_modules/@types/express/index.d.ts(84,15): error TS2315: Type 'Request' is not generic..

Related: #21022

@MichalLytek

This comment has been minimized.

Copy link
Contributor

commented Dec 26, 2017

@rhyek Because generics were rollbacked:

Reverts express-serve-static-core and its dependent packages to compatibility with TypeScript 2.1 by removing type parameters from Request.
#20820 (comment)

You need to make the generic by yourself:

import { Express } from "express";

declare module "express" {
  export interface Request<
    Body = any,
    Query = any,
    Params = any,
    Cookies = any,
  > extends Express.Request {
    body: Body;
    query: Query;
    params: Params;
    cookies: Cookies;
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.