Skip to content

Duplicate definitions for simple file that uses module.exports #33520

@mjbvz

Description

@mjbvz

From microsoft/vscode#80678

TypeScript Version: 3.7.0-dev.20190919

Search Terms:

Repo
For the JavaScript:

module.exports.test = async () => {
    return 123;
}

module.exports.test();

Run go to definition on test in test()

Expected behavior:
It returns a single definition for the function

Actual behavior:
Two definitions are returned

[Trace  - 6:36:34 PM] <semantic> Sending request: definitionAndBoundSpan (260). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "/Users/matb/projects/san/m1.js",
    "line": 5,
    "offset": 17
}
[Trace  - 6:36:34 PM] <semantic> Response received: definitionAndBoundSpan (260). Request took 2 ms. Success: true 
Result: {
    "definitions": [
        {
            "file": "/Users/matb/projects/san/m1.js",
            "start": {
                "line": 1,
                "offset": 16
            },
            "end": {
                "line": 1,
                "offset": 20
            },
            "contextStart": {
                "line": 1,
                "offset": 1
            },
            "contextEnd": {
                "line": 1,
                "offset": 20
            }
        },
        {
            "file": "/Users/matb/projects/san/m1.js",
            "start": {
                "line": 1,
                "offset": 23
            },
            "end": {
                "line": 3,
                "offset": 2
            }
        }
    ],
    "textSpan": {
        "start": {
            "line": 5,
            "offset": 16
        },
        "end": {
            "line": 5,
            "offset": 20
        }
    }
}

Related Issues:

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions