Recently, I've been working on setting up a web app in TypeScript but I seem to be missing some essential types that are required.
Every time I compile using npm run build
, it keeps throwing errors like:
Error TS2304: Cannot find name 'HTMLElement'.
Error TS2304: Cannot find name 'SVGElement'.
Error TS2304: Cannot find name 'EventTarget'.
Error TS2304: Cannot find name 'TouchEvent'.
Error TS2304: Cannot find name 'MouseEvent'.
Error TS2304: Cannot find name 'PointerEvent'.
After doing some research, it seems like these types should already be included with Typescript by default and might be part of the ES6 types. Specifically, they can be found in this link: https://github.com/Microsoft/TypeScript/blob/master/lib/lib.es6.d.ts.
Below is an excerpt from my package.json
file:
{ "name": "wip", "version": "1.0.0", "description": "", "main": "index.html", "dependencies": { "hammerjs": "2.0.8" }, "devDependencies": { … }, "scripts": { "test": "mocha test --require ts-node/register test/**/*.ts && npm run build", "dev": "webpack-dev-server --watch --content-base . -d --progress", "build": "tsc" }, "author": "", "license": "ISC" }
Does anyone have any suggestions on how to fix this issue?