After upgrading from typescript 2.2, I encountered an issue with the following example.
interface ILayoutResult {
id: string;
data: any;
}
interface ILayout{
getResult<T extends ILayoutResult | ILayoutResult[] | void>() :T;
}
class test implements ILayout{
getResult(){
return {id:"a", data:"aa"} as ILayoutResult ;
}
}
I faced an error stating that the types of property 'getResult' are incompatible.
It mentioned that Type '() => ILayoutResult' is not assignable to type '<T extends void | ILayoutResult | ILayoutResult[]>() => T'.
Also, it pointed out that Type 'ILayoutResult' is not assignable to type 'T'.