Skip to content

allowSyntheticDefaultImports is required to use this library #279

@silasbw

Description

@silasbw

See #275 (comment).

Our tsconfig.json sets both esModuleInterop and allowSyntheticDefaultImports to true.

If users of this library don't set allowSyntheticDefaultImports to true they'll get compile errors. If we want to catch these compile errors in CI we need to disable both esModuleInterop (because it forces allowSyntheticDefaultImports) and allowSyntheticDefaultImports.

If we disable esModuleInterop, tsc will generate broken .js code when using default imports (import foo from 'foo') on CommonJS modules (that don't have declarations). When importing such modules, you must explicitly use the CommonJS-style import (import foo = require('foo')).

Another option is to require users of this library to set allowSyntheticDefaultImports to true in their project.

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