Babel.js VSCode未显示导入的JS类中的JSDoc定义

pqwbnv8z  于 2022-12-16  发布在  Babel
关注(0)|答案(1)|浏览(201)

我在vscode中遇到了一个问题,当我在另一个js文件中导入一个js类时,我看不到该类中定义的jsdocs。
./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
ruarlubt

ruarlubt1#

./src/index.js

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

const jim = new Person("jim", 88)

jim不是字符串。您应该更改"jim"

相关问题