diff --git a/package.json b/package.json index d6edd2e..19dff12 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,13 @@ ], "license": "MIT", "main": "dist/index.js", + "exports": { + ".": { + "require": "./dist/index.js", + "types": "./dist/index.d.ts" + }, + "./package.json": "./package.json" + }, "peerDependencies": { "@types/nodemailer": "^6.4.9", "nodemailer": "^6.9.4" diff --git a/src/lib/transport.ts b/src/lib/transport.ts index bfe64de..f9ac4bf 100644 --- a/src/lib/transport.ts +++ b/src/lib/transport.ts @@ -1,5 +1,4 @@ import { Transport } from "nodemailer"; -import MailMessage from "nodemailer/lib/mailer/mail-message"; import MailtrapClient from "./MailtrapClient"; import normalizeCallback from "./normalizer"; @@ -11,6 +10,7 @@ import { MailtrapResponse, MailtrapTransporter, NormalizeCallback, + MailMessage, } from "../types/transport"; const { TRANSPORT_SETTINGS } = CONFIG; diff --git a/src/types/transport.ts b/src/types/transport.ts index 5c83062..0522c23 100644 --- a/src/types/transport.ts +++ b/src/types/transport.ts @@ -1,6 +1,6 @@ import NodemailerMail = require("nodemailer/lib/mailer"); -import { Transporter } from "nodemailer"; +import { Transport, Transporter } from "nodemailer"; import { SendResponse, SendError, @@ -51,3 +51,5 @@ export interface MailtrapTransporter extends Transporter { mailOptions: MailtrapMailOptions | MailtrapMailOptionsSandbox ): Promise; } + +export type MailMessage = Parameters["send"]>[0]; diff --git a/tsconfig.json b/tsconfig.json index 3f5ecf7..ef6d79f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,10 @@ "declaration": true, "outDir": "./dist", "skipLibCheck": true, - "esModuleInterop": true + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "declarationMap": true, + "forceConsistentCasingInFileNames": true }, "include": ["src"], "exclude": ["node_modules", "examples"]