Skip to content
Open
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
12 changes: 8 additions & 4 deletions packages/client/src/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ import {ClientResponse} from "@sendgrid/client/src/response";
declare class Client {
constructor();

/**
* Class itself, attached at runtime via `module.exports.Client = Client`.
* Lets `import client = require("@sendgrid/client")` consumers reach the
* class via `client.Client`.
*/
Client: typeof Client;

/**
* Set the SendGrid API key.
*/
Expand Down Expand Up @@ -52,7 +59,4 @@ declare class Client {
}

declare const client: Client;
// @ts-ignore
export = client

export {Client};
export = client;
15 changes: 8 additions & 7 deletions packages/mail/src/mail.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import {Client} from "@sendgrid/client";
import sgClient = require("@sendgrid/client");
import {ClientResponse} from "@sendgrid/client/src/response";
import {ResponseError} from "@sendgrid/helpers/classes";
import {MailDataRequired} from "@sendgrid/helpers/classes/mail";

type Client = InstanceType<typeof sgClient.Client>;

declare class MailService {
/**
* Class itself, attached at runtime via `module.exports.MailService = MailService`.
*/
MailService: typeof MailService;

/**
* SendGrid API key passthrough for convenience.
*/
Expand Down Expand Up @@ -41,10 +48,4 @@ declare class MailService {
}

declare const mail: MailService;
// @ts-ignore
export = mail;

export {MailService};
export {MailDataRequired};
export {ClientResponse};
export {ResponseError};
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"noEmit": true,
"module": "commonjs",
"target": "es6",
"baseUrl": ".",
"types": ["node"],
"paths": {
"@sendgrid/*": ["packages/*"]
"@sendgrid/*": ["./packages/*"]
}
},
"include": [
Expand Down
Loading