@edwin
, this is very easy to understand if you already understand type of interface in typescript
You can write the same thing like this
interface arg{
(ar)=>void
}
interface middlewareInter{
forEach:(argument:arg)=>void // look at forEach function in js how it written
}
private middlewares(middlew:middlewareInter){
}
it return void because don't wanna handle the result there. void is a type in typescript which just tell that the function does not return anything
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I have a question, I am just learning typescript, I do not understand this.
private middlewares(middleWares: { forEach: (arg0: (middleWare: any) => void) => void; })
what does { forEach: (arg0: (middleWare: any) => void) => void; } this do?
why could you not do this?
private middlewares(middleWares: any)
@edwin , this is very easy to understand if you already understand type of interface in typescript
You can write the same thing like this
interface arg{
(ar)=>void
}
interface middlewareInter{
forEach:(argument:arg)=>void // look at forEach function in js how it written
}
private middlewares(middlew:middlewareInter){
}
it return void because don't wanna handle the result there. void is a type in typescript which just tell that the function does not return anything