Skip to content

Conversation

@benjaminpjones
Copy link
Contributor

@benjaminpjones benjaminpjones commented Dec 21, 2025

Move @aws-sdk/client-sesv2 (v7) and @aws-sdk/client-ses (v6) from dependencies to devDependencies so users who install @types/nodemailer don't pull in the large AWS SDK dependency tree.

Replace AWS SDK type imports with structural "like" types that match the shape nodemailer actually needs. This works because TypeScript uses structural typing - the real AWS SDK types will still be accepted when users install the SDK themselves for SES transport.

Fixes discussion #74080

Note: this is largely in line with how nodemailer itself treats aws-sdk - it's not a direct dep. See docs:

The AWS SES SDK is not included with Nodemailer, so you need to install it separately:
npm install @aws-sdk/client-sesv2


Template:

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
    • N/A - my code doesn't use the ses bits
  • Add or edit tests to reflect the change.
    • I didn't add tests, but I kept the existing ones the same to ensure these are still compatible with the AWS lib
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run pnpm test nodemailer.

Changing an existing definition:

Move @aws-sdk/client-sesv2 (v7) and @aws-sdk/client-ses (v6) from
dependencies to devDependencies so users who install @types/nodemailer
don't pull in the large AWS SDK dependency tree.

Replace AWS SDK type imports with structural "like" types that match
the shape nodemailer actually needs. This works because TypeScript
uses structural typing - the real AWS SDK types will still be accepted
when users install the SDK themselves for SES transport.

Fixes discussion DefinitelyTyped#74080

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@typescript-bot
Copy link
Contributor

typescript-bot commented Dec 21, 2025

@benjaminpjones Thank you for submitting this PR! I see this is your first time submitting to DefinitelyTyped 👋 — I'm the local bot who will help you through the process of getting things through.

This is a live comment that I will keep updated.

1 package in this PR

Code Reviews

Because this is a widely-used package, a DT maintainer will need to review it before it can be merged.

You can test the changes of this PR in the Playground.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ✅ Only a DT maintainer can approve changes without tests

All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 74249,
  "author": "benjaminpjones",
  "headCommitOid": "3519f3c8e13bd26f74468311e11c0747c0533a65",
  "mergeBaseOid": "2d215e38ab25e0588d9d59d329ec7562f9869fed",
  "lastPushDate": "2025-12-21T02:30:29.000Z",
  "lastActivityDate": "2026-01-26T19:16:22.000Z",
  "mergeOfferDate": "2026-01-26T18:42:12.000Z",
  "mergeRequestDate": "2026-01-26T19:16:22.000Z",
  "mergeRequestUser": "benjaminpjones",
  "hasMergeConflict": false,
  "isFirstContribution": true,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "nodemailer",
      "kind": "edit",
      "files": [
        {
          "path": "types/nodemailer/lib/ses-transport/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/nodemailer/package.json",
          "kind": "package-meta-ok"
        },
        {
          "path": "types/nodemailer/v6/lib/ses-transport/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/nodemailer/v6/package.json",
          "kind": "package-meta-ok"
        }
      ],
      "owners": [
        "rogierschouten",
        "dex4er",
        "bioball"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "weswigham",
      "date": "2026-01-26T18:41:31.000Z",
      "isMaintainer": true
    }
  ],
  "mainBotCommentID": 3678375124,
  "ciResult": "pass"
}

@typescript-bot
Copy link
Contributor

Hey @benjaminpjones,

😒 Your PR doesn't modify any tests, so it's hard to know what's being fixed, and your changes might regress in the future. Please consider adding tests to cover the change you're making. Including tests allows this PR to be merged by yourself and the owners of this module.

This can potentially save days of time for you!

@typescript-bot
Copy link
Contributor

🔔 @rogierschouten @dex4er @bioball — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

@benjaminpjones
Copy link
Contributor Author

😒 Your PR doesn't modify any tests, so it's hard to know what's being fixed, and your changes might regress in the future. Please consider adding tests to cover the change you're making. Including tests allows this PR to be merged by yourself and the owners of this module.

This PR fixes dependency bloat - there's not a great test for it. I did intentionally leave existing tests the same so to ensure this is still compatible with the aws-sdk types.

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in Pull Request Status Board Dec 21, 2025
@typescript-bot
Copy link
Contributor

Re-ping @rogierschouten, @dex4er, @bioball:

This PR has been out for over a week, yet I haven't seen any reviews.

Could someone please give it some attention? Thanks!

@typescript-bot typescript-bot added the Unreviewed No one showed up to review this PR, so it'll be reviewed by a DT maintainer. label Jan 1, 2026
@typescript-bot
Copy link
Contributor

It has been more than two weeks and this PR still has no reviews.

I'll bump it to the DT maintainer queue. Thank you for your patience, @benjaminpjones.

(Ping @rogierschouten, @dex4er, @bioball.)

@typescript-bot typescript-bot moved this from Needs Maintainer Review to Needs Maintainer Action in Pull Request Status Board Jan 8, 2026
@jakebailey
Copy link
Member

Do you have a way to cross reference the types here to what nodemailer uses under the hood?

@benjaminpjones
Copy link
Contributor Author

@jakebailey thank you for taking a look.

Do you have a way to cross reference the types here to what nodemailer uses under the hood?

I took a second pass at manually cross-referencing against the nodemailer source, a couple changes:

  • v7 (SESv2): lib/ses-transport/index.js - uses this.ses.sesClient.send(command), new this.ses.SendEmailCommand(sesMessage), and this.ses.sesClient.config.region() for region detection
  • v6: lib/ses-transport/index.js @ v6.9.16 - uses ses.send(new aws.SendRawEmailCommand(sesMessage)) for v3 API or ses.sendRawEmail(sesMessage).promise() for v2 API

There's no automated way to verify these structural types match. Is there a standard approach in DT for cross-referencing structural types against an underlying implementation? Or is manual review the expectation here?

Copy link
Contributor

@weswigham weswigham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, manual review to ensure it matches the package's internal uses is all you can do if you're looking to structurally match those uses. Means the types might shift based on minor/internal changes, or you loosen them a bunch, but that's not so bad.

@typescript-bot typescript-bot added Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner and removed Unreviewed No one showed up to review this PR, so it'll be reviewed by a DT maintainer. labels Jan 26, 2026
@typescript-bot
Copy link
Contributor

@benjaminpjones: Everything looks good here. I am ready to merge this PR (at 3519f3c) on your behalf whenever you think it's ready.

If you'd like that to happen, please post a comment saying:

Ready to merge

and I'll merge this PR almost instantly. Thanks for helping out! ❤️

(@rogierschouten, @dex4er, @bioball: you can do this too.)

@typescript-bot typescript-bot moved this from Needs Maintainer Action to Waiting for Author to Merge in Pull Request Status Board Jan 26, 2026
@benjaminpjones
Copy link
Contributor Author

Ready to merge

@typescript-bot typescript-bot moved this from Waiting for Author to Merge to Recently Merged in Pull Request Status Board Jan 26, 2026
@typescript-bot typescript-bot merged commit 37ca828 into DefinitelyTyped:master Jan 26, 2026
4 checks passed
@benjaminpjones benjaminpjones deleted the nodemailer-remove-aws-sdk-dep branch January 27, 2026 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Critical package Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner Untested Change This PR does not touch tests

Projects

Status: Recently Merged

Development

Successfully merging this pull request may close these issues.

4 participants