The annotation you've currently written says that getHelpDocs
is of type IHelpDocs
:
export const getHelpDocs: IHelpDocs = ...
What you probably wanted to convey instead is that it's a function that takes no arguments and returns IHelpDocs
:
export const getHelpDocs: () => IHelpDocs = ...
What may be confusing here is the type annotation. For functions, you can annotate the return type as follows:
export function getHelpDocs(): IHelpDocs { ... }
For variables, you'll need to annotate the whole shebang, otherwise Typescript won't know to expect a function — it could just as well be that you did want to have just the interface.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…