Home:ALL Converter>Define Function Type, Function Interface in Typescript

Define Function Type, Function Interface in Typescript

Ask Time:2018-05-15T15:33:10         Author:option 12

Json Formatter

Is it possible to define a function interface in typescript?

for instance, when we have things such as

meth (a : {b: B, c: C}) : {b: B, c: C} {...}

we can write

interface A {
    b : B;
    c : C;
}
meth (a : A) : A {...}

however, when we have something like

meth (a : (b: B) => C) : (b: B) => C {...}

can we do something similar, like define a function type so that we can write

meth (a : A) : A {...}

again?

Author:option 12,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/50344685/define-function-type-function-interface-in-typescript
yy