loneshark99
loneshark99

Reputation: 714

Understanding Intellisense in Vscode

I am new to nodejs and started using vscode recently but pretty good with Javascript and its wonderful features. I am having some trouble understanding the parameters that the intellisense is showing.

enter image description here

What exactly does this line mean, this intellisense is so confusing!. Is there some extension that I can install which will give the boiler plate code if I want to use for eg: watch method.

Thanks and please dont down vote, this is a genuine question as to how to make sense of the intellisence.

Thanks

Upvotes: 1

Views: 158

Answers (1)

Maria Ines Parnisari
Maria Ines Parnisari

Reputation: 17486

listener?: (event: string, filename: string) => any

From left to right:

  • fs.watch accepts an optional argument listener (the ? indicates this)
  • listener should be a function accepting two parameters: event and filename. (Technically you could write a function that doesn't accept any, but you'd lose information)
  • listener doesn't need to return anything (=> any)

There's more information here, including how VS Code actually generates this annotations.

Upvotes: 1

Related Questions