【问题标题】:VSCode is not displaying the JSDoc define within an imported JS ClassVSCode 未在导入的 JS 类中显示 JSDoc 定义
【发布时间】:2022-01-17 18:47:19
【问题描述】:

我在 vscode 中遇到问题,当在另一个 js 文件中导入该类时,我看不到该 js 类中定义的 jsdocs。悬停或使用 vscode 快捷方式时不会。

./src/person/index.js

/**
* This is a person class.
*/
export default class Person{

    /**
    * Person constructor
    * @param {string} Name of the person
    * @param {number} Age of the person
    */
    constructor(name, age){
        this.name = name;
        this.age = age;
    }
}

./src/index.js

import { Person } from './src/person/index.js'

const jim = new Person("him", 88) // jsdoc is not recognized

【问题讨论】:

    标签: javascript node.js babeljs jsdoc


    【解决方案1】:

    ./src/index.js

    import { Person } from './src/person/index.js'
    
    const jim = new Person("jim", 88)
    
    

    jim 不是字符串。你应该改变"jim"

    【讨论】:

    • 不是问题。我试图举个例子。但在保存任何东西或运行任何东西之前。我想将鼠标悬停在“new Person()”上并查看“./src/index.js”中类的 JSDoc。仅供参考 Person 类的 JSDoc 在 './src/person/index.js' 中工作
    猜你喜欢
    • 1970-01-01
    • 2020-11-25
    • 1970-01-01
    • 2020-07-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-01
    • 2019-07-26
    相关资源
    最近更新 更多