You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sap/ui/test/matchers/Ancestor and sap/ui/test/matchers/Properties classes are not inheriting the generic class (in contrast to other matcher classes laying in sap/ui/test/matchers path). Therefore, passing these 2 classes as matchers to waitFor call causes type error like Type 'Ancestor' is not assignable to type 'Matcher | Matcher[]'.ts.
Same is true for sap/ui/test/matchers/Descendant and sap/ui/test/matchers/Sibling. Technically, those four matcher implementations indeed do not extend the Matcher base class and that's valid for Opa5. The type of waitFor's matchers property expects one or multiple values of type sap.ui.test.Opa5.Matcher which is a union:
declare module "sap/ui/test/Opa5"{
...
importUI5Elementfrom"sap/ui/core/Element";importMatcher1from"sap/ui/test/matchers/Matcher";
...
/** * Matchers used to filter controls. */exporttypeMatcher=|((p1: UI5Element)=>void)// this is intended to match the 4 implementations under. discussion|Record<string,object>|Matcher1;}
The problem is that the four matchers don't document their constructors to return a function matching the first variant of the union type.
Maybe documenting them as a @class doesn't work out and they rather should be documented as factory @functions. I first have to check how this can be represented correctly in JSDoc and then let the owners of the OPA5 APIs know.
Until then, you only can cast the matchers.
BTW: void in the signature of the first variant is nonsense, should be boolean or any.
sap/ui/test/matchers/Ancestor
andsap/ui/test/matchers/Properties
classes are not inheriting the generic class (in contrast to other matcher classes laying insap/ui/test/matchers
path). Therefore, passing these 2 classes as matchers towaitFor
call causes type error likeType 'Ancestor' is not assignable to type 'Matcher | Matcher[]'.ts
.Checked in @sapui5/[email protected]
The text was updated successfully, but these errors were encountered: