know that for returns in function this is how we define a type :
function add(a,b) :number {
return a+b
}
but what we do in case that a function returns another function ? should we do this ?
function a (a) : Function {
return function b (b) :number {
return a+b
}
}
function add(a: number): (b: number) => number { return function (b: number): number { return a + b; }; }
this one is a little wierd like we already have ( return function (b:number) : number{} why we do it also right after (a:number) too !
you don't need to
Well you have to think about which parts are in type position and which parts are in value position
Обсуждают сегодня