Skip to content

v11 breaks ESM compatibility #84

@david-guevara-gorillalogic

Description

Here is a repo with the reproduction: https://github.com/david-guevara-gorillalogic/mailosaur-esm-issue.

Reproduction steps

  1. Clone https://github.com/david-guevara-gorillalogic/mailosaur-esm-issue
  2. Execute pnpm install
  3. Execute pnpm run check (i.e. tsc --noEmit)
  4. See the type error.

Expected result

TypeScript should compile without errors.

Current result

TS2351: This expression is not constructable.
Type 'typeof import(".../node_modules/mailosaur/cjs/mailosaur")' has no construct signatures.

Details

The code is essentially:

import MailosaurClient from "mailosaur";
const client = new MailosaurClient("not-a-real-api-key");

With this tsconfig:

{
  "compilerOptions": {
    "module": "NodeNext"
  }
}

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