我在 JavaScript 中有以下两行:
/** @type {*} */
const slides = document.getElementsByClassName("x");
我正在使用 JSDoc 来记录这一行。 “*”需要替换为数据类型。这应该是什么? VS Code 说它是一个 HTML 集合。我尝试了“string[]”,但出现错误。 “对象”有效,但这似乎很通用。
我认为它应该是一个 HTMLCollectionOf Element。
/** @type {HTMLCollectionOf<Element>} */
const slides = document.getElementsByClassName("x");