Skip to content

Type Definitions Not Found #53

@euhansarkar

Description

@euhansarkar

📧 Problems Sending Emails via Brevo (@getbrevo/brevo) in TypeScript

Image

Description

I am unable to send transactional emails using Brevo's (@getbrevo/brevo / sib-api-v3-typescript) packages in my TypeScript project. I have tried multiple approaches (CommonJS, ESModules, named imports, default imports) but always run into type errors or import issues. Even the basic import { TransactionalEmailsApi } from '@getbrevo/brevo' statement doesn’t compile.

I haven't found any working example or clear documentation for TypeScript that resolves these issues.


Reproduction Steps

  1. Install package
    npm install @getbrevo/brevo
    # or: npm install sib-api-v3-typescript
  2. Create services/email.ts
    import { TransactionalEmailsApi, SendSmtpEmail } from '@getbrevo/brevo';
    
    const client = new TransactionalEmailsApi();
  3. Compile/Run
    tsc
    # or: ts-node services/email.ts

Actual Behavior

  • TypeScript Errors:
    TS2305: Module '"@getbrevo/brevo"' has no exported member 'TransactionalEmailsApi'.
    OR
    TS1192: Module '"@getbrevo/brevo"' has no default export.
  • Import Failures at runtime:
    Error [ERR_REQUIRE_ESM]: require() of ES Module ... not supported.

Expected Behavior

  • Successful compilation of TypeScript files that import Brevo’s client classes.
  • Runtime ability to send transactional emails via client.sendTransacEmail(...) without errors.

Environment

  • Node.js: v22.14.x
  • TypeScript: v5.5.x
  • @getbrevo/brevo: v2.2.x
  • sib-api-v3-sdk: v3.13.x (if tested)
  • OS: macOS/Linux/Windows 10

Attempts & Notes

  • Tried both CommonJS (require('@getbrevo/brevo')) and ESModule (import ... from '@getbrevo/brevo').
  • Verified node --experimental-modules but still faced ERR_REQUIRE_ESM.
  • Checked package.json "type": "module" and removed it, but then lost ES import support.
  • Looked at dist/index.js in @getbrevo/brevo—it seems to be ESM but type declarations mismatch.
  • No clear examples in the official docs for TypeScript.

Thank you! Let me know if any additional details or logs would help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions