简体   繁体   English

JSDoc类型转换为`window`吗?

[英]JSDoc type cast for `window`?

I'm curious what type definition I should use for a window being passed into a function. 我很好奇应该为传递给函数的窗口使用什么类型定义。 Normally I use HTMLElement, but I don't think the window is an HTMLElement 通常我使用HTMLElement,但我不认为窗口是HTMLElement

Thanks! 谢谢!

typeof(window) returns object . typeof(window)返回object If you are looking to define the interface type it inherits from: 如果要定义接口类型,则它继承自:

The window object implements the Window interface, which in turn inherits from the AbstractView interface. window对象实现了Window接口,该接口又从AbstractView接口继承。

https://developer.mozilla.org/en-US/docs/Web/API/Window https://developer.mozilla.org/zh-CN/docs/Web/API/Window

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM