在我第一次尝试 TypeScript 编程时,我一直在使用全局变量文档和窗口,但没有声明它们的类型。对此有推荐的做法吗?例如,是否建议声明如下内容:
var 文档:文档; var window : 窗口;
最佳答案
Is there a recommended practice on this? For instance, is it advisable to declare something like:
var document : Document; var window : Window;
没有。编译器使用名为 lib.d.ts
的文件将它们包含在您的编译上下文中。
更多
https://basarat.gitbooks.io/typescript/content/docs/types/lib.d.ts.html
关于typescript - 在 TypeScript 程序中,是否应该声明全局变量文档和窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36484199/