Skip to content

Typescript issue after types change in 3.1.0 #394

@jekh

Description

@jekh

The types update in 3.1.0 appears to have caused an issue when importing and using Anvil in a typescript project, at least when using ESM.

In 3.1.0 (but not 3.0.1), typescript appears to think Anvil is a namespace, and doesn't recognize it as a class.
image

This expression is not constructable.
  Type 'typeof import("file:///node_modules/@anvilco/anvil/types/src/index")' has no construct signatures.

The issue appears to occur because of this change in index.d.ts from export = Anvil to export default Anvil. Manually changing that single line back appears to fix the type error.

I'm not totally sure why that change would cause this issue, or what the implications of it are. Only that it does seem to be the culprit!

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