Skip to content
This repository was archived by the owner on Sep 27, 2024. It is now read-only.
This repository was archived by the owner on Sep 27, 2024. It is now read-only.

Importing @matrix-org/matrix-wysiwyg with esm + typescript results in error due to exports in package.json #976

@MTRNord

Description

@MTRNord

Problem

TSC spits out this error for any import:

error TS7016: Could not find a declaration file for module '@matrix-org/matrix-wysiwyg'. '<redacted>/node_modules/@matrix-org/matrix-wysiwyg/dist/matrix-wysiwyg.js' implicitly has an 'any' type.
  There are types at '<redacted>/node_modules/@matrix-org/matrix-wysiwyg/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@matrix-org/matrix-wysiwyg' library may need to update its package.json or typings.

Steps to reproduce

Import the package in an esm module project with these compilerOptions (these are somewhat vitejs as an origin):

    "compilerOptions": {
        "experimentalDecorators": false,
        "emitDecoratorMetadata": false,
        "resolveJsonModule": true,
        "esModuleInterop": true,
        "module": "es2022",
        "moduleResolution": "Bundler",
        "target": "es2020",
        "noUnusedLocals": true,
        "sourceMap": false,
        "outDir": "./lib",
        "declaration": true,
        "jsx": "react",
        "lib": ["es2021", "dom", "dom.iterable"],
        "strict": true,
        "allowImportingTsExtensions": true,
        "isolatedModules": true,
        "noEmit": true,
    },

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions