diff --git a/packages/client/src/client.d.ts b/packages/client/src/client.d.ts index 84075d1f9..c1696cf78 100644 --- a/packages/client/src/client.d.ts +++ b/packages/client/src/client.d.ts @@ -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. */ @@ -52,7 +59,4 @@ declare class Client { } declare const client: Client; -// @ts-ignore -export = client - -export {Client}; +export = client; diff --git a/packages/mail/src/mail.d.ts b/packages/mail/src/mail.d.ts index fa827498d..0fc8511d1 100644 --- a/packages/mail/src/mail.d.ts +++ b/packages/mail/src/mail.d.ts @@ -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; + declare class MailService { + /** + * Class itself, attached at runtime via `module.exports.MailService = MailService`. + */ + MailService: typeof MailService; + /** * SendGrid API key passthrough for convenience. */ @@ -41,10 +48,4 @@ declare class MailService { } declare const mail: MailService; -// @ts-ignore export = mail; - -export {MailService}; -export {MailDataRequired}; -export {ClientResponse}; -export {ResponseError}; diff --git a/tsconfig.json b/tsconfig.json index b8d1ada33..f61d45bf8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,9 +3,9 @@ "noEmit": true, "module": "commonjs", "target": "es6", - "baseUrl": ".", + "types": ["node"], "paths": { - "@sendgrid/*": ["packages/*"] + "@sendgrid/*": ["./packages/*"] } }, "include": [