Skip to content

JSDoc Does not Pick up Type imported using Require #14056

Closed
@mjbvz

Description

@mjbvz

From microsoft/vscode#20238

TypeScript Version: 2.1.6

Code

foo.js:

export class Foo {
    /**
     * @param {string} name
     * @param {number} id
     */
    constructor(name, id) {
        this.name = name;
        this.id = id
    }
}

index.js:

const {Foo} = require('./foo');

/**
 * @param {Foo} param
 */
function func(param) {

}

Expected behavior:
The type of param is Foo

Actual behavior:
The type of param is any.

If I change the import to import {Foo} from './foo', the type of param is correct

Metadata

Metadata

Assignees

Labels

Domain: JSDocRelates to JSDoc parsing and type generationFixedA PR has been merged for this issueSuggestionAn idea for TypeScriptVS Code TrackedThere is a VS Code equivalent to this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions