Skip to content

Broken type import from @sendgrid/mail #1380

Open
@controversial

Description

@controversial

Compiling the following import statement:

import { MailDataRequired } from '@sendgrid/mail';

compiles without error using tsc, but the latest tsgo fails to resolve the import:

node_modules/@sendgrid/mail/src/mail.d.ts:1:9 - error TS2596: 'Client' can only be imported by turning on the 'esModuleInterop' flag and using a default import.

1 import {Client} from "@sendgrid/client";
          ~~~~~~
test.ts:1:10 - error TS2305: Module '"@sendgrid/mail"' has no exported member 'MailDataRequired'.

1 import { MailDataRequired } from '@sendgrid/mail';
           ~~~~~~~~~~~~~~~~

Found 2 errors in 2 files.

Errors  Files
     1  node_modules/@sendgrid/mail/src/mail.d.ts:1
     1  test.ts:1

This reproduces in a blank project with only typescript, @typescript/native-preview, and @sendgrid/mail installed.

Using the following minimal, modern tsconfig (not using any ancient or to-be-deprecated module resolution settings):

{
  "compilerOptions": {
    "target": "es2023",
    "module": "esnext",
    "moduleResolution": "bundler",
    "noEmit": true,
  },

  "include": ["**/*.ts"],
  "exclude": ["**/node_modules"]
}

also reproduces with module: preserve, module: node16 and other common module settings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: Module ResolutionRelated to module resolution and module checker errorsDomain: Type CheckingRelated to type checking, grammar checking

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions