Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module '"enzyme"' has no exported ... #259

Open
cieniawska opened this issue Sep 25, 2023 · 4 comments
Open

Module '"enzyme"' has no exported ... #259

cieniawska opened this issue Sep 25, 2023 · 4 comments

Comments

@cieniawska
Copy link

Hello,

after upgrading to typescript v5.2.2 I'm facing some issues with your package.
Screenshot 2023-09-25 at 11 49 57

I'm using:

  • "enzyme-adapter-preact-pure": "^4.1.0",
  • "@types/enzyme": "^3.10.14",

Can you please assist?

@robertknight
Copy link
Member

I can reproduce with examples/typescript/ in this repository by upgrading the typescript dependency to a 5.x release. It looks like the extensions to the Enzyme types in https://github.com/preactjs/enzyme-adapter-preact-pure/blob/master/index.d.ts, which are included in the package, are not being seen by TS any more.

For examples/typescript/ I was able to work around this by manually copying the types into the local project:

cd examples/typescript/
npm install typescript@latest
cp node_modules/enzyme-adapter-preact-pure/index.d.ts enzyme-extensions.d.ts
npm test

I am not sure of the proper fix for this in TS 5.0 offhand. If anyone knows, feel free to chime in.

@cieniawska
Copy link
Author

hello, is there anything else we could do about it? 🤔

@janek-j-survicate
Copy link

Also waiting for update

@acelaya
Copy link

acelaya commented Feb 26, 2024

A possible workaround for this is to reference "enzyme-adapter-preact-pure/index.d.ts" in your tsconfig.json compilerOptions.types setting.

{
  "compilerOptions": {
    // ...
    "types": ["enzyme-adapter-preact-pure/index.d.ts"],
  },
  // ...
}

I would have assumed that adding a reference as /// <reference types="enzyme-adapter-preact-pure/index.d.ts" /> should also work, but it doesn't.

The good thing about referencing the types from within the tsconfig file, is that you no longer need to add /// <reference types="enzyme-adapter-preact-pure" /> anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants