From 461268efc574fdd1efffb065d64b776389c3a28f Mon Sep 17 00:00:00 2001 From: simmons8616 Date: Thu, 23 Aug 2018 17:55:46 +0800 Subject: [PATCH] modify tsconfig and tslint.json --- .../express-wechat-access-tests.ts | 2 +- types/express-wechat-access/index.d.ts | 31 ++++++++++--------- types/express-wechat-access/tsconfig.json | 2 +- types/express-wechat-access/tslint.json | 12 +------ 4 files changed, 20 insertions(+), 27 deletions(-) diff --git a/types/express-wechat-access/express-wechat-access-tests.ts b/types/express-wechat-access/express-wechat-access-tests.ts index 659c5b3639..60cc5d9d88 100644 --- a/types/express-wechat-access/express-wechat-access-tests.ts +++ b/types/express-wechat-access/express-wechat-access-tests.ts @@ -3,7 +3,7 @@ import * as weAccessMiddleware from 'express-wechat-access'; const app: express.Application = express(); -const options: weAccessMiddleware.IWeAccessMidOption = { +const options: weAccessMiddleware.WeAccessMidOption = { appId: 'xxxxx', appSecret: 'xxxxx' }; diff --git a/types/express-wechat-access/index.d.ts b/types/express-wechat-access/index.d.ts index f871d1733e..fb0d58701d 100644 --- a/types/express-wechat-access/index.d.ts +++ b/types/express-wechat-access/index.d.ts @@ -5,31 +5,34 @@ // TypeScript Version: 2.2 /// -/// import { Response, NextFunction } from 'express'; import * as http from 'http'; import { EventEmitter } from 'events'; -interface IMidOption { - accessTokenUrl?: string; - ticketUrl?: string; - appId: string; - appSecret: string; - https?: boolean; -} - -type IMiddleware = (req: any, res: Response | http.ServerResponse, next: NextFunction) => any; +type WeMiddleware = (req: any, res: Response | http.ServerResponse, next: NextFunction) => any; declare function weAccessMiddleware( - options: IMidOption, + options: { + accessTokenUrl?: string; + ticketUrl?: string; + appId: string; + appSecret: string; + https?: boolean; + }, errorHandler?: (e: any) => any -): IMiddleware; +): WeMiddleware; declare namespace weAccessMiddleware { - interface IWeAccessMidOption extends IMidOption {} + interface WeAccessMidOption { + accessTokenUrl?: string; + ticketUrl?: string; + appId: string; + appSecret: string; + https?: boolean; + } - interface IWeAccessMiddleware extends IMiddleware, EventEmitter, Function {} + interface WeAccessMiddleware extends WeMiddleware, EventEmitter, Function {} } export = weAccessMiddleware; diff --git a/types/express-wechat-access/tsconfig.json b/types/express-wechat-access/tsconfig.json index 9924528f6b..e24d740f2c 100644 --- a/types/express-wechat-access/tsconfig.json +++ b/types/express-wechat-access/tsconfig.json @@ -7,7 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictFunctionTypes": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/types/express-wechat-access/tslint.json b/types/express-wechat-access/tslint.json index 886d87b3b7..3db14f85ea 100644 --- a/types/express-wechat-access/tslint.json +++ b/types/express-wechat-access/tslint.json @@ -1,11 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "interface-name": false, - "no-empty-interface": false, - "no-namespace": false, - "no-reference-import": false, - "no-var-keyword": false, - "strict-export-declare-modifiers": false - } -} +{ "extends": "dtslint/dt.json" }