Can someone confirm how to implement interface Iuser on function user. I know it is possible but not able to get through it.
interface IUser {
infomation(): Promise<object>;
groups(): Promise<object[]>;
}
//something like below implementation
function user(options?: Options): IUser {
infomation: function infomation(): Promise<object> {
....;
}
groups: function groups(): Promise<object> {
.....;
}
}
Sorry if I wasn't clear on my question, what I am trying to do it here is trying to convert my JavaScript code to typed typescript code.
So that if I type
user(some options).
Then all functions under users will appear.
returnthat type so this would work?user({ option: 'a' }).groups()?