Skip to content

Need to enable 'esModuleInterop' in tsconfig after upgrading to v5 #4879

@dagstuan

Description

@dagstuan

Hi,

After upgrading to react-select@5 I get an error from tsc when building unless I enable esModuleInterop in my own tsconfig.json. This should not be required.

The error seems to be in Select.d.ts:

node_modules/react-select/dist/declarations/src/Select.d.ts:1:8 - error TS1259: Module '"/.../node_modules/@types/react/index"' can only be default-imported using the 'esModuleInterop' flag

1 import React, { Component, FocusEventHandler, FormEventHandler, KeyboardEventHandler, MouseEventHandler, ReactNode, RefCallback, TouchEventHandler } from 'react';
         ~~~~~

  node_modules/@types/react/index.d.ts:65:1
    65 export = React;
       ~~~~~~~~~~~~~~~
    This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.


Found 1 error.```

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/bug-confirmedIssues about a bug that has been confirmed by a maintainerissue/has-prIssue has a PR attached to it that may solve the issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions