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

[Question] Why "@preact/playwright-ct" types are not available? #9

Closed
chrisha22 opened this issue Jan 18, 2023 · 12 comments · Fixed by #10
Closed

[Question] Why "@preact/playwright-ct" types are not available? #9

chrisha22 opened this issue Jan 18, 2023 · 12 comments · Fixed by #10

Comments

@chrisha22
Copy link

chrisha22 commented Jan 18, 2023

I have a project with preact and I installed the package preact/playwright-ct, however, Im seeing this error when importing config on my config.ts file :
"resource": "/playwright-ct.config.ts",
"owner": "typescript",
"code": "2307",
"message": "Cannot find module '@preact/playwright-ct' or its corresponding type declarations."

Does anyone know how to fix it? is there a missing dependency , maybe?
@developit

@JoviDeCroock
Copy link
Member

Hey, does it fix itself if you add

{
  "types": "./dist/index.d.mts"
}

to the package json in your node_modules, if so we are missing that field in our package. The new resolution mechanism for newer TS versions is included

@chrisha22
Copy link
Author

@JoviDeCroock I was checking the package.json for the node_modules>@preact>playwright-ct and that field is already inside. I tried adding "moduleResolution": "NodeNext" in the ts.config and the error is no longer shown inside the test file import, but it is still appearing inside the playwright-ct.config.ts and also there is like a warning saying that NodeNext is unstable.

@JoviDeCroock
Copy link
Member

It's not their at the first-level, only in the export-map. Mind putting it at the base level as well?

@chrisha22
Copy link
Author

chrisha22 commented Jan 18, 2023

I’m sorry @JoviDeCroock I think I'm not following, do you mean adding
{
"types": "./dist/index.d.mts"
}

at the root level of my project's package.json? or where exactly?

@JoviDeCroock
Copy link
Member

Of the package json of our package @preact/playwright-ct it seems to be missing from the latest release so just adding it above this line without nodeNext

@chrisha22
Copy link
Author

Like this?

"name": "@preact/playwright-ct",
 "version": "0.0.2",
 "description": "Playwright Component Testing for Preact",
 "repository": "github:preact/playwright-ct",
 "keywords": [
   "Preact",
   "Playwright",
   "testing"
 ],
 "author": "Marvin Hagemeister <hello@marvinh.dev>",
 "license": "MIT",
 "types": "./dist/index.d.mts",
 "exports": {
   ".": {
     "types": "./dist/index.d.ts",
     "default": "./dist/index.js"
   },
   "./hooks": {
     "types": "./dist/hooks.d.mts",
     "default": "./dist/hooks.mjs"
   }
 },

@JoviDeCroock
Copy link
Member

Yes, but index.d.ts sorry I misstyped

@chrisha22
Copy link
Author

chrisha22 commented Jan 18, 2023

yes, that fixed it!, when is it gonna be available so I can update the package with that change?

@JoviDeCroock
Copy link
Member

JoviDeCroock commented Jan 18, 2023

I mean, when someone makes a Pull Request and it gets released 😅

@chrisha22
Copy link
Author

@JoviDeCroock Since you guys will add the fix for the types Issue in a next version, I'll mark this as resolved, but the problem will still present, I'll be looking forward to get this version as soon as it is available.

Thanks for helping

@chrisha22
Copy link
Author

I tried to create a PR with the change so you guys could check it but Unfortunately I couldn’t.

@JoviDeCroock
Copy link
Member

Published as 0.1.1

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

Successfully merging a pull request may close this issue.

2 participants