Reputation: 2385
I'd love to do something like this:
function myFunction(arg1: string, arg2: number): boolean {
//some code here
}
interface myInterface {
someOtherProperty: string
myFunction: myFunction // should be the equivalent of (arg1: string, arg2: Number) => boolean
}
Is this possible?
Upvotes: 1
Views: 24
Reputation: 249466
You can use typeof
in a type context to get the type of any value:
function myFunction(arg1: string, arg2: number): boolean {
return false;
}
interface myInterface {
someOtherProperty: string
myFunction: typeof myFunction
}
Upvotes: 2