Currently, I am utilizing TypeScript along with jQuery in my project, however, I keep encountering the following error:
Uncaught TypeError: $ is not a function
Has anyone come across this issue before?
The process involves compiling TypeScript to ES2017 and then transpiling it to ES5 using webpack.
//tsconfig
{
"compileOnSave": true,
"compilerOptions": {
"module": "es2015",
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true,
"target": "es2017",
"noImplicitAny": false,
"outDir": "Output",
"esModuleInterop": true
}
}
This is how jQuery is being imported and used:
import * as $ from "jquery";
var form = $(document.createElement('form'));
Initially, the browser recognizes jQuery ($) https://i.sstatic.net/2LH8q.png
However, afterward, I encounter this error: https://i.sstatic.net/UttzF.png