请问下`(property)`在方法名前面指的是什么意思?方法的展示不是说只有参数和返回值吗?

(property) registerNodeConstructor (nodeset any, type ony.tiff

(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);
}
回复
阅读 723
1 个回答

(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;
  }
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏