I noticed there are several issues opened against "2 definitions", noticeably https://github.com/Microsoft/vscode/issues/51459 & https://github.com/Microsoft/TypeScript/issues/24861
But I don't think my issue is the same (I don't use ts or react, just nodejs code). It happens when I export like this
function downloadVoice() {
...
}
module.exports = {
downloadVoice
}
// If I export like this it will not happen
// module.exports = downloadVoice
But when I hover over to the place when the function is called, vscode can show the definition correctly,

The 2 definitions warning:

Does this issue occur when all extensions are disabled?: Yes
I can't repo this in a simple project:
x.js:
function downloadVoice() {
}
module.exports = {
downloadVoice
}
// If I export like this it will not happen
// module.exports = downloadVoice
y.js:
const { downloadVoice } = require('./x')
downloadVoice
Please test using the code 1.29. If you still see this, please provide a complete code example that shows this problem
Hi it is very easy to reproduce
First use express generator to create a simple project, then change router/index.js to this
var express = require("express");
var router = express.Router();
/* GET home page. */
router.get("/", function(req, res, next) {
res.render("index", { title: "Express" });
});
function hi() {
console.log("hi");
}
module.exports = { router, hi };
And in app.js import like this
var dup = require("./routes/index");
var usersRouter = require("./routes/users");
dup.hi();
Then click dup.hi() to see the warning.
I tested 1.29, it still has the problem.
Confirmed with TS 3.2.0-dev.20181114
Hi I believe this bug has been there for a long time and it is quite annoying. Do you have plan to fix it recently ?
Most helpful comment
Hi I believe this bug has been there for a long time and it is quite annoying. Do you have plan to fix it recently ?