Here is an interface I have:
export interface ITreeViewItem {
getChildren: Promise<ITreeViewItem[]>;
...
Now, let's take a look at the implementation of it:
export class MyClass implements ITreeViewItem {
public async getChildren(): Promise<ITreeViewItem[]> {
let result = await this._fileSystemService.getContents(this.fullPath);
let items = result.map(x => {
let y: ITreeViewItem = null;
return y;
});
return items;
}
...
Although everything seems to be correct to me, I encounter an error message that reads:
Types of property 'getChildren' are incompatible.
Type '() => Promise' is not assignable to type 'Promise'.
Property 'then' is missing in type '() => Promise'.
I'm trying to figure out what could be potentially wrong with my getChildren
implementation. Any insights or suggestions would be greatly appreciated!
Just to provide some context, I am currently working with TypeScript 2.5.3.