I have a file, which must be loaded asynchronously, so I made a function, which loads this file and returns the Promise:
export function load() {
// ...
return import(filename);
}
What is the return type of this Function? Promise<any> works, but it feels very weird. I'd like to write the signature as.
export function load() -> Promise<???>;
You need to use an import type and TypeScript 2.9 or higher. Here is an example:
my_module.ts
demo.ts
tsconfig.json (Added for reference)