-
Notifications
You must be signed in to change notification settings - Fork 154
[typescript] Cannot find name 'JQuery' #96
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
Comments
I just experienced the same thing when bumping to the latest version (5.0.2) |
Sorry, I don't have the bandwidth to look at this right now. Anyone is welcome to dig a little bit and suggest a solution. |
We've had a discussion about this over in the DefinitelyTyped repo DefinitelyTyped/DefinitelyTyped#40099 |
@simjes that thread does not really offer a solid workaround. In my case I had to add the compiler option I wonder if this would be a problem if this package included its own typings instead of hosting the typings on the definitel-typed project? The problem seems to stem from its usage of the global namespace and the typescript compiler's greediness when loading @types/. Just a thought. I assume there is some historical context for why the types are not co-located with this project. |
@a-b-r-o-w-n Do you know if there is a Cypress had a lot of issues with global/namespace conflicts and chose to not directly require any but instead copy/paste type definitions nested in Cypress type definitions. In most cases, this solved namespace collisions assuming the Type definitions were originally a part of this project, but the source code is not in Typescript so the type definitions were moved to DefinitelyTyped: #68
Let us know if you are still running into issues. |
I see the same error with @testing-library/cypress version 5.2.1. |
@a-b-r-o-w-n I updated the reproduction repo a bit by changing the File in full: {
"compilerOptions": {
"outDir": "./lib/",
"module": "commonjs",
"lib": ["es2015", "dom"],
"target": "es5",
"moduleResolution": "node",
"strict": true,
"types": ["cypress"],
},
"exclude": [
"node_modules"
],
} Changes: diff --git a/packages/client/tsconfig.json b/packages/client/tsconfig.json
index dda9816..8bbbb78 100644
--- a/packages/client/tsconfig.json
+++ b/packages/client/tsconfig.json
@@ -2,11 +2,12 @@
"compilerOptions": {
"outDir": "./lib/",
"module": "commonjs",
+ "lib": ["es2015", "dom"],
"target": "es5",
"moduleResolution": "node",
"strict": true,
+ "types": ["cypress"],
},
- "include": ["./src/**/*"],
"exclude": [
"node_modules"
],
I added I also added the I dropped the @JochenDiekenbrock Maybe this could help you as well? |
Thank you, @NicholasBoll Adding |
@JochenDiekenbrock I'm not sure how your monorepo is set up. The project I work on has a base tsconfig that all packages inherit from that has Only the |
For a more concrete example:
|
I hit this issue in a repo that does not have any monorepo/lerna setup. Tried various things from this discussion here and also from the one linked to above in DT, and nothing helped. The only thing that helped was to explicitly install Here's the tsconfig files if that helps: root tsconfig{
"compilerOptions": {
"noEmit": true,
"allowJs": true,
"checkJs": true,
"target": "es6",
"moduleResolution": "Node",
"resolveJsonModule": true,
"declaration": true,
"noImplicitReturns": true,
"jsx": "react",
"allowSyntheticDefaultImports": true,
"baseUrl": "."
},
"include": ["./src/**/*"],
"exclude": ["node_modules", "built", "cypress"]
} cypress/tsconfig.json{
"compilerOptions": {
"strict": true,
"baseUrl": "../node_modules",
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress"]
},
"exclude": []
} |
I ran into the same issue in a monorepo that uses Yarn Workspaces and where Cypress wasn't installed at the root and where no root I got rid of the warning with the same workaround that @gnapse proposed, by adding |
This is probably resolved now that the type defs are built-in. |
cypress-testing-library
version: 5.0.2node
version: 12.13.0npm
(oryarn
) version: (yarn) 1.19.1What you did:
Installed
@testing-library/cypress
in monorepo root (yarn add -W -D @testing-library/cypress
).What happened:
Unrelated build failures in
packages/
resulting inReproduction repository:
https://github.com/a-b-r-o-w-n/testing-library-cypress-bug
https://github.com/a-b-r-o-w-n/testing-library-cypress-bug/runs/303541569
The text was updated successfully, but these errors were encountered: