I am experimenting with TypeScript. I wanted to clean up my files by importing and exporting functions. But I need jQuery, so I imported it using import * as $ from './jquery';. But I get this error:
Uncaught TypeError: $ is not a function
What have I done wrong?
Thank you!
Downloading the js file is not something that in modern JS happens anymore. One would expect to set up the project with npm and use a bundler.
In any way, you have two alternatives:
declare const $, on the top of the file. This won't activate the IntelliSense suggestions but will prevent TypeScript to complain about the missing symbol
npm i --save-dev @types/jquery, if you are already using npm, will download the type definitions for jQuery and activate the IntelliSense suggestions