function Foo(): string {}
Means a Foo is a function that returns a string.
interface SFC {
    (props: Props): any;
}
const Foo: SFC = p => {};
Means that Foo is an anonymous function matching the signature SFC and p is of type Props.
How can I declare function Foo() that matches SFC? What's the syntax?
i.e., I want to declare a function using the function keyword (not const) and the function itself is of type SFC.
These don't work:
function Foo: SFC () {}
function Foo() {}: SFC
                Named Functions: In JavaScript, named functions are simply a way of referring to a function that employs the function keyword followed by a name that can be used as a callback to that function. Normal functions with a name or identifier are known as named functions.
A JavaScript function is defined with the function keyword, followed by a name, followed by parentheses (). Function names can contain letters, digits, underscores, and dollar signs (same rules as variables). The parentheses may include parameter names separated by commas: (parameter1, parameter2, ...)
TypeScript uses duck typing, so the Foo function is of type SFC if their structure matches.
interface SFC {
    (props: any): any;
}
function Foo(props: any): any {
    console.log(props);
}
let sfc: SFC = Foo; // Foo is of type SFC.
sfc("Foo");
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With