Skip to content

Commit

Permalink
typescript: add support for locations option in matchedData
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavohenke committed Oct 19, 2017
1 parent 84b2afe commit bb5f928
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions filter/index.d.ts
@@ -1,5 +1,5 @@
import * as express from 'express';
import { Sanitizer } from '../shared-typings';
import { Sanitizer, Location } from '../shared-typings';

export function matchedData (req: express.Request, options?: MatchedDataOptions): { [key: string]: any };
export const sanitize: SanitizationChainBuilder;
Expand All @@ -9,7 +9,8 @@ export const sanitizeParam: SanitizationChainBuilder;
export const sanitizeQuery: SanitizationChainBuilder;

interface MatchedDataOptions {
onlyValidData: boolean
onlyValidData?: boolean
locations?: Location[]
}

export interface SanitizationChainBuilder {
Expand Down
1 change: 1 addition & 0 deletions filter/type-definition.spec.ts
Expand Up @@ -13,6 +13,7 @@ const res: Response = <Response>{};

matchedData(req).foo;
matchedData(req, { onlyValidData: true }).bar;
matchedData(req, { locations: ['body', 'params'] }).bar;

// Sanitization
sanitize('foo')(req, res, () => {});
Expand Down

0 comments on commit bb5f928

Please sign in to comment.