请问下`(property)`在方法名前面指的是什么意思?方法的展示不是说只有参数和返回值吗?
(property) registerNodeConstructor: (nodeSet: any, type: any, constructor: any, options: any) => void
我在vscode里面 hover 一个方法时,会显示出这个样式。
请问下(property)
在前面指的是什么意思?方法的展示不是说只有参数和返回值吗?
更新
方法的内容是function:
function registerNodeConstructor(nodeSet,type,constructor,options) {
if (nodeConstructors.hasOwnProperty(type)) {
throw new Error(type+" already registered");
}
//TODO: Ensure type is known - but doing so will break some tests
// that don't have a way to register a node template ahead
// of registering the constructor
var nodeSetInfo = getFullNodeInfo(nodeSet);
if (nodeSetInfo) {
if (nodeSetInfo.types.indexOf(type) === -1) {
// A type is being registered for a known set, but for some reason
// we didn't spot it when parsing the HTML file.
// Registered a type is the definitive action - not the presence
// of an edit template. Ensure it is on the list of known types.
nodeSetInfo.types.push(type);
}
}
nodeConstructors[type] = constructor;
nodeOptions[type] = options;
if (options) {
if (options.dynamicModuleList) {
externalModules.register(type,options.dynamicModuleList);
}
}
events.emit("type-registered",type);
}
回复
1个回答

test
2024-07-18
(property)是属性,也就是你声明了一个类,下面挂载的属性就会提示测试了,如果是这种写法提示为属性:
class Test {
static name: string // 属性,会提示(property)
// 这种写法,同样会提示(property)
static getName: () => string = () => {
return this.name;
}
}
而(method)才是方法,使用下面这种写法就会提示
class Test {
static name: string // 属性,会提示(property)
// 方法,会提示(method)
static getName(): string {
return this.name;
}
}
回复

适合作为回答的
- 经过验证的有效解决办法
- 自己的经验指引,对解决问题有帮助
- 遵循 Markdown 语法排版,代码语义正确
不该作为回答的
- 询问内容细节或回复楼层
- 与题目无关的内容
- “赞”“顶”“同问”“看手册”“解决了没”等毫无意义的内容