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

fix: remove @type/express #675

Merged
merged 7 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/typescript/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ client.messages.list({}, (err, messages) => {
console.log('Listing messages using callbacks');
messages.forEach(function(message){
console.log(message.sid);
});
});
});

// List messages using promises
Expand All @@ -124,7 +124,7 @@ promiseMessage.then(messages => {
console.log('Listing messages using promises');
messages.forEach(function(message){
console.log(message.sid);
});
});
});

const twiml = new twilio.twiml.VoiceResponse();
Expand Down
23 changes: 13 additions & 10 deletions lib/webhooks/webhooks.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { Request, Response } from 'express';
import {IncomingHttpHeaders} from "http2";

type Middleware = (
request: Request,
response: Response,
next: () => void
) => any;
interface Request {
protocol: string;
header(name: string): string | undefined;
headers: IncomingHttpHeaders;
originalUrl: string;
rawBody?: any;
body: any;
}

export interface RequestValidatorOptions {
/**
Expand Down Expand Up @@ -144,7 +147,7 @@ export function validateExpressRequest(
* protocol: 'https'
* });
*/
export function webhook(): Middleware;
export function webhook(opts: WebhookOptions): Middleware;
export function webhook(authToken: string, opts: WebhookOptions): Middleware;
export function webhook(opts: WebhookOptions, authToken: string): Middleware;
export function webhook(): any;
export function webhook(opts: WebhookOptions): any;
export function webhook(authToken: string, opts: WebhookOptions): any;
export function webhook(opts: WebhookOptions, authToken: string): any;
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@
"xmlbuilder": "^13.0.2"
},
"devDependencies": {
"@types/express": "^4.17.7",
"@types/lodash": "4.14.112",
"@types/node": "9.6.57",
"@types/qs": "6.9.4",
"eslint": "^7.3.1",
"express": "^4.17.1",
"jasmine": "~3.5.0",
Expand All @@ -47,7 +44,7 @@
"node-mocks-http": "^1.8.1",
"nyc": "^15.1.0",
"proxyquire": "^2.1.3",
"typescript": "^2.8.3"
"typescript": "^2.9.2"
},
"scripts": {
"test": "npm run test:javascript && npm run test:typescript",
Expand Down