I'm building an electron js app with some js libraries like prismjs.
I tried adding @types/prismjs to my node modules and many other ways
but still typescript tries to import it import {something} from "prismjs"
(in generated js file which I don't want it)
I have seen similar questions in stack overflow but none of them solved my issue.
app/ts config
{
"compilerOptions": {
"module": "ES2020",
"target": "ES2021",
"noImplicitAny": true,
"removeComments": true,
"allowUnreachableCode": false,
"strictNullChecks": true,
"strict": true,
"noImplicitUseStrict": false,
"alwaysStrict": true,
"allowSyntheticDefaultImports": true,
"typeRoots": ["../node_modules/@types"],
"sourceMap": true
}
}
app/script.ts
import { highlightElement } from "prismjs";
window.addEventListener("keyup", ev => {
if (ev.key === "F5") window.location.reload();
});
const el = document.querySelectorAll("code")[1];
el.onkeyup = () => {
highlightElement(el);
};
project structure enter image description here