I have following type:
type VerifyResultFunction = <T extends ResultBase>(result: T) => boolean;
Now I have class with extends ResultBase
class XResult extends ResultBase {
test!: string[];
}
Finally I try to define my own VerifyResultFunction, which would check XResult Objects:
let verifyX: verifyResultFunction = (result: XResult) => {
result.test.length == 33 && result.id == 12;
}
This code runs fine, but I see following warning in VS Code:
Type ‘(result: XResult) => void’ is not assignable to type ‘verifyResultFunction’.
Types of parameters ‘result’ and ‘result’ are incompatible.
Type ‘T’ is not assignable to type ‘XResult’.
Property ‘test’ is missing in type ‘ResultBase’ but required in type ‘XResult’.ts(2322)
What am I missing?