In my Meteor/React project I have the following line:
let gameId = window.prompt("Please enter the ID of the game you wish to load.");
TypeScript gives the transpiling error Cannot find name 'window'
. I am using barbatus/typescript , with default compiler options:
{ "module": "commonjs", "target": "es5", "moduleResolution": "node", "experimentalDecorators": true, "emitDecoratorMetadata": true, "sourceMap": true }
I tried creating a tsconfig.json in the root of my Meteor project, copying the above compiler options but appending the line:
"lib": ["es2015", "dom"]
However, the error remains.
我在 tsconfig.json 的 lib compilerOptions 中添加了“dom”,然后这个问题就解决了。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.