我如何告诉我的 IDE (PHPStorm) 某些全局变量不是“未声明”,而只是在其他地方声明;并有特定的类型?
来自 Magento ( ) 的示例opcheckout.js
:
if (response.duplicateBillingInfo) {
shipping.setSameAsBilling(true); // "shipping undeclared" warning
}
// in fact, shipping is a global variable with constructor "Shipping".
我想做的是这样的:
/** @var Shipping window.shipping */
shipping.setS // with autocompletion:
setSameAsBilling