How to use typescript for client side javascript?

Viewed 267

I have been using typescript + eslint successfully for node.js. But now when I try to use it for regular client side javascript, I get this

error TS2304: Cannot find name 'alert'.

when I try to do a basic alert(1);.

How can I get it to recognize regular javascript types? Do I need to install something further?

1 Answers

I think, you should check you tsconfig.json, where you should have dom library

"compilerOptions": {
  ...
  "lib": ["es2019", "dom"],
  ...
}
Related