After installing jquery
and @types/jquery
I can't seem to get JQuery to work in my typescript file.
If I use:
import * as $ from 'jquery';
$("#test").addClass("className");
I get the following error on $("#test")
:
TS2349: Cannot invoke an expression whose type lacks a call signature.
If I follow WebStorm's recommended change of changing the import to:
import $ from 'jquery';
Then no errors show but when trying to compile the file I get the error:
error TS1192: Module '"C:/Users/Home/Desktop/react/hello-world/node_modules/@types/jquery/index"' has no default export.
I've looked at a dozen other StackOverFlow posts and nothing has helped. Any ideas?