I am trying to incorporate jQuery into my Angular 5 project using TypeScript 2.8.1. I attempted to follow Ervin Llojku's solution but it didn't work:
First, install jquery via npm
npm install --save jquery
Next, install the jquery types
npm install --save-dev @types/jquery
Include jquery in your .angular-cli.json file
"apps": [{ ... "scripts": [ "../node_modules/jquery/dist/jquery.min.js", ], ... }]
I also tried adding the import statements in app.module.ts or directly in the component:
import * as $ from 'jquery';
No matter what I do, the TypeScript compiler keeps throwing this error:
Error:(7, 15) TS2497: Module ''jquery'' resolves to a non-module entity and cannot be imported using this construct.