I want to configure tsconfig.json for code that only runs on the server and to throw error when I use window or document object. Is it possible?

19 views Asked by At

I am writing a script to be only run in a node.js (server) environment and not in the browser. What I have noticed is that the typescript compiler auto completes the window and document object as if they would be available. Is there a way to configure the tsconfig.json file to only target servers. I tried moduleResolution: node and few others but could not get it to work.

I tried changing the tsconfig.json attributes but could not get it to work.

0

There are 0 answers