Say I have a typescript file, named hello-service.ts:
export function hello1() { ... }
export function hello2() { ... }
export function hello3() { ... }
In some cases, we want the type of this module. We can refer it in another ts file like this:
import * as helloService from './hello-service.ts';
function getHelloModule(): typeof helloService {
return hello;
}
But I want to know, if is it possible to define such a type inside the hello-service.ts file itself?
For now, I can only achieve this by specifying every function, and which is quite boring:
export type HelloServiceType = {
hello1: typeof hello1,
hello2: typeof hello2,
hello3: typeof hello3
}
Is there any simpler solution?