Skip to content
This repository has been archived by the owner on Feb 18, 2022. It is now read-only.

Check whether the package *actually* has a default #1

Open
DanielRosenwasser opened this issue Mar 4, 2019 · 0 comments
Open

Check whether the package *actually* has a default #1

DanielRosenwasser opened this issue Mar 4, 2019 · 0 comments

Comments

@DanielRosenwasser
Copy link
Member

And emit a message like

This package was declared using `module.exports = ...` or some variant. It should be declared with an `export = ...` like one of the following:

### Variables

```ts
declare var xyz: SomeType;

export = xyz;
```

### Classes

```ts
class Foo {
  // ...
}

export = Foo
```

### Functions

```ts
function foo(): any;

export = foo;
```

You can then import using a more appropriate syntax like

```ts
import foo = require("foo");
```

Alternatively, to import the entity using a default import as follows, you will need to enable `esModuleInterop`.

```ts
import foo from "foo";
```

[See more here in the FAQ](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/9f9f6430117d025aef62ed56128deb65508edc86/README.md#a-package-uses-export--but-i-prefer-to-use-default-imports-can-i-change-export--to-export-default).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant