I am looking to define a specification for a function that returns its input argument, regardless of its type. The crucial aspect here is to mirror the interface of the argument in the return value.
For instance, when I type z.
on line 6 as shown in the image below, I expect the code editor to provide auto-completion options, with a being one of them.
https://i.sstatic.net/tyzVq.png
How can I specify this in JSDoc?
Given that TypeScript's inference does not cover this scenario, I am using VS Code and working with vanilla JavaScript. How can I achieve this using JSDoc?
function returnMe(x) {
return x
}
const z = returnMe({a:2})
z. // 👈 here I want to get auto completion