When working in VS + C#, typing +=
to an event automatically generates the event handler method scaffolding with the correct argument/return types. In TypeScript, is it possible for VS Code to offer similar functionality?
For instance, take a look at the code snippet below:
import * as http from 'http';
http.createServer
While VS Code displays the callback type in a pop-up and provides detailed information if we press F12 to navigate to definitions, inserting onReq
and selecting "Ctrl+.:Add missing method declaration" results in the following placeholder:
function onReq(onReq: any)
{
throw new Error('Function not implemented.');
}
This generic insertion seems ineffective. Wouldn't it be more helpful if it added something like this instead?
function onReq(req: http.IncomingMessage, res: http.ServerResponse)
{
throw new Error('Function not implemented.');
}
Is there a specific step I missed, or is it that despite having all the necessary information, VS Code cannot provide accurate scaffolding?
https://i.stack.imgur.com/J1ZPh.png