What does colon do in a javascript function parameter -


i saw in javascript code written young guy function

function foo(e:mouseevent){    ... } 

i want e:mouseevent do?

'e:mouseevent' named parameter type declaration in typescript. colon used in typescript parameters bind parameter specific type which, in case, type 'mouseevent'.

e used parameter name javascript event. given type it's function responds click event.

you can read more details syntax under 'function types' heading of typescript's official documentation: https://www.typescriptlang.org/docs/handbook/functions.html.


Comments