@types/jquery fail my compilation
See original GitHub issueHi all,
I’m not sure it’s the good place for this ticket…
Today, I ran nom update
and my compilation fail.
ERROR in /*****/node_modules/ng2-materialize/dist/textarea/textarea.directive.d.ts (21,27): Generic type 'JQuery<TElement, HTMLElement>' requires 2 type argument(s).
I found this: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/17239.
With this in my package.json "@types/jquery": "^2.0.47",
, I fix the build process.
Maybe you can add it in your package.json?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Typescript and JQuery compile error: Cannot find name '$'
If I use import $ = require("jquery") in my test.ts file, another error " Cannot find module jquery " will occur when doing...
Read more >Types | jQuery API Documentation
Types. This page documents data types appearing in jQuery function signatures, whether defined by JavaScript itself or further restricted by jQuery.
Read more >Getting some compilation errors while compiling the TS files in ...
Argument of type 'HTMLCollectionOf<Element>' is not assignable to parameter of type 'NodeListOf<Element>'. This error maybe need to cast the datatype in ...
Read more >TypeScript - Cypress Documentation
The "types" will tell the TypeScript compiler to only include type ... will address instances where the project also uses @types/chai or @types/jquery...
Read more >Cannot find Type defination file for datatables.net
Error Build:Cannot find type definition file for 'jquery'. ... When I add datatables.net 1.11.3 I get the following errors when compiling:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @DarkIsDude,
When creating a new project there is actually a problem with the version of
@types/jquery
that is pulled via@types/materialize-css
as it pull on the latest type version which is made for JQuery 3.This will be fix in 1.5.0 but in the meanwhile the workaround is exactly what you did, install manually the right version of
@types/jquery
Using yarn
Or plain npm
@Atticus29 I created a new angular application with the dependencies your provided but I had to make some changes so it can works.
Follow the
+/-
(green and red highlights) below to see the changes I made and the explanations under the snippet.package.json
2 versions of
jquery
installedYou have 2 versions of
jquery
(2.2.4 because it is specified in thepackages.json
file and 3.2.12 because it is a dependency ofmaterialize-css
) but you won’t need2.2.4
anymore.typescript
version missmatch@types/jquery
requirestypescript
to be 2.3.0 at least (see reference here). But updatingtypescript
to 2.3.0 means you need to update@angular/cli
to 1.5.0 to match the requiredtypescript
version for the CLI.@angular/animations
package is missingIn order for the animations to work correctly you will need to install the
@angular/animations
packages.Is running
npm cache clean --force
dangerous?Not at all, it only removes the already downloaded packages from your disk which mean it will have to download it again next time packages are asked to be installed.