Node api document and vscode jump to the definition of the function definition is not the same?

node version is v10.4.1
that"s what it says in the document

http.createServer([options][, requestListener])

previously it was said that [] meant an optional parameter, so

  1. requestListener is a function whose arguments are given by options?
  2. all the options,requestListener here are optional parameters? So what determines the parameters of the requestListener function?

beginners don"t understand very well. Please explain in detail what it says in
vscode

.

export function createServer (requestListener?: (request: IncomingMessage, response: ServerResponse) = > void): Server;
how is this different from that in api documents? does it mean the same thing?


  1. requestListener is a function whose arguments have nothing to do with options .
  2. here options , requestListener are optional parameters. requestListener this function has parameters given by the document and accepts two parameters, the first being request: IncomingMessage and the second response: ServerResponse .
  3. strictly speaking, what is in vscode is indeed different from that in api documents, with the omission of options . Api documents shall prevail.
< hr >

the subject asks, let's make up how you can see it

http.createServer

The requestListener is a function which is automatically added to the 'request' event.
In the last sentence of

, requestListener is a listener function attached to the 'request' event.

then turn to Event: 'request'

These are the parameters that the listener function of the

'request' event accepts.

Menu