mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-26 19:04:13 +08:00
Merge pull request #28232 from simmons8616/master
add express-wechat-access types
This commit is contained in:
18
types/express-wechat-access/express-wechat-access-tests.ts
Normal file
18
types/express-wechat-access/express-wechat-access-tests.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import express = require('express');
|
||||
import * as weAccessMiddleware from 'express-wechat-access';
|
||||
|
||||
const app: express.Application = express();
|
||||
|
||||
const options: weAccessMiddleware.WeAccessMidOption = {
|
||||
appId: 'xxxxx',
|
||||
appSecret: 'xxxxx'
|
||||
};
|
||||
|
||||
app.use(
|
||||
weAccessMiddleware(
|
||||
options,
|
||||
e => {
|
||||
console.error(e);
|
||||
}
|
||||
)
|
||||
);
|
||||
38
types/express-wechat-access/index.d.ts
vendored
Normal file
38
types/express-wechat-access/index.d.ts
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
// Type definitions for express-wechat-access 1.1
|
||||
// Project: https://github.com/simmons8616/express-wechat-access
|
||||
// Definitions by: Simmons Zhang <https://github.com/simmons8616>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Response, NextFunction } from 'express';
|
||||
import * as http from 'http';
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
type WeMiddleware = (req: any, res: Response | http.ServerResponse, next: NextFunction) => any;
|
||||
|
||||
declare function weAccessMiddleware(
|
||||
options: {
|
||||
accessTokenUrl?: string;
|
||||
ticketUrl?: string;
|
||||
appId: string;
|
||||
appSecret: string;
|
||||
https?: boolean;
|
||||
},
|
||||
errorHandler?: (e: any) => any
|
||||
): WeMiddleware;
|
||||
|
||||
declare namespace weAccessMiddleware {
|
||||
interface WeAccessMidOption {
|
||||
accessTokenUrl?: string;
|
||||
ticketUrl?: string;
|
||||
appId: string;
|
||||
appSecret: string;
|
||||
https?: boolean;
|
||||
}
|
||||
|
||||
interface WeAccessMiddleware extends WeMiddleware, EventEmitter, Function {}
|
||||
}
|
||||
|
||||
export = weAccessMiddleware;
|
||||
23
types/express-wechat-access/tsconfig.json
Normal file
23
types/express-wechat-access/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"express-wechat-access-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/express-wechat-access/tslint.json
Normal file
1
types/express-wechat-access/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user