Skip to content

Commit

Permalink
Replace any by mixed in express_v4.x.x.js (#1737)
Browse files Browse the repository at this point in the history
Using `any` will effectively disable the type checker anywhere you use the
`req.body` property, which is dangerous. By declaring it as a `mixed` type, it
allows you to use it, but you'll have to make sure that any assumptions you
make about its contents are checked first, which is the way to go.
  • Loading branch information
nvie authored and gantoine committed Jan 29, 2018
1 parent 03669c2 commit 9f7cf2a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ declare type express$RequestParams = {

declare class express$Request extends http$IncomingMessage mixins express$RequestResponseBase {
baseUrl: string;
body: any;
body: mixed;
cookies: { [cookie: string]: string };
connection: Socket;
fresh: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ declare type express$RequestParams = {

declare class express$Request extends http$IncomingMessage mixins express$RequestResponseBase {
baseUrl: string;
body: any;
body: mixed;
cookies: {[cookie: string]: string};
connection: Socket;
fresh: boolean;
Expand Down

0 comments on commit 9f7cf2a

Please sign in to comment.