0
votes

I refer to this type definition file: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/nodemailer/index.d.ts, which has a total of nine exports: 3 each of type, interface, and function.

There is no default export defined in this file. However, I am able to do the following:

import NM from "nodemailer";

and then NM can access the three functions exported: createTestAccount, createTransport, and getTestMessageUrl. For the other exports in that file, I have to import explicitly, for example:

import { SendMailOptions, Transporter } from "nodemailer";

Where is the default export defined for this type definition?

In the same project, I created my own test module with an export but not declaring it as a default. The compiler balked if I imported using the default syntax.

My compiler option for module is ES2015, if it is of any relevance.

1

1 Answers

0
votes

You must have allowSyntheticDefaultImports in your tsconfig file. This allows default imports from modules with no default export.

If there is no default export typescript imports the module as if you had written import * as NM from 'nodemailer'