【发布时间】:2020-01-17 18:21:57
【问题描述】:
问题
我试图通过将函数的参数提取为全局常量来重构visual-studio-code 中的一些代码。但是,一旦我这样做了,我就无法在编辑该对象时使用intellisense!
一些例子
我真的想要这个功能与我不熟悉的工具和库,但为了简单起见,我在下面做了一个简单的例子来演示我所指的内容。
智能感知示例
提取对象没有智能感知的示例
测试示例
/**
* Example to test intellisense
* @param {Object} person
* @param {string} person.first
* @param {string} person.last
*/
function sayName(person) {
console.log(person.first, person.last);
}
// Intellisense works here! ????
sayName({first: "Robert", last: "Todar"});
// Intellisense doesn't work here.. ☹
const person = {
first: "Robert",
last: "Todar"
}
sayName(person);
问题
当我从函数中提取参数时,有什么方法可以获得智能感知?
【问题讨论】:
标签: visual-studio-code intellisense javascript visual-studio-code intellisense