Typescript intellisense 适用于此:
class SampleClass {
/**
* Does stuff
*
* @param blah stuff needing done
*/
public doStuff(blah: string) {
}
}
var sample = new SampleClass();
// intellisense works correctly and shows parameter description:
sample.doStuff("hello");
但是切换到使用粗箭头似乎破坏了 jsdoc 智能感知(方法签名仍然出现,但 jsdoc 描述都没有):
class SampleClass2 {
/**
* Does stuff
*
* @param blah stuff needing done
*/
public doStuff = (blah: string) => {
}
}
var sample2 = new SampleClass2();
// intellisense gives the method signature still but no longer picks up any of the jsdoc descriptions:
sample2.doStuff("hello");
我正在使用 Visual Studio 2012 Update 4; typescript 0.9.5。
这是一个错误,还是我需要对 jsdoc 注释使用不同的语法?
最佳答案
老实说,我很困惑为什么这在 TypeScript Playground 中有效。
要在 Visual Studio 中进行这项工作,函数文档需要放在函数表达式本身上:
class SampleClass2 {
public doStuff =
/**
* Does stuff
*
* @param blah stuff needing done
*/
(blah: string) => {
}
}
var sample2 = new SampleClass2();
sample2.doStuff("hello");
关于visual-studio-2012 - 来自 Typescript jsdoc 的 Visual Studio intellisense 不适用于胖箭头功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20646473/