-
-
Notifications
You must be signed in to change notification settings - Fork 59
Closed
Description
ChainablePromiseElement and ChainablePromiseArray are not resolved correctly because of the provided generics. IDE shows them defined as any.
Once generics are removed, it is no longer any and the tsc command unfolds typing issues
src/matchers/element/toHaveAttribute.ts:59:56 - error TS2345: Argument of type 'Element | ChainablePromiseElement' is not assignable to parameter of type 'Element | ElementArray'.
Type 'ChainablePromiseElement' is not assignable to type 'Element | ElementArray'.
Type 'ChainablePromiseElement' is not assignable to type 'Element'.
Types of property 'parent' are incompatible.
Type 'Promise<Element | Browser | MultiRemoteBrowser>' is not assignable to type 'Element | Browser'.
59 const result = await executeCommand.call(this, el, conditionAttr, {}, [attribute])
~~
src/matchers/element/toHaveAttribute.ts:65:34 - error TS2345: Argument of type 'Element | ChainablePromiseElement' is not assignable to parameter of type 'string | Element | ElementArray'.
Type 'ChainablePromiseElement' is not assignable to type 'string | Element | ElementArray'.
Type 'ChainablePromiseElement' is not assignable to type 'Element'.
Types of property 'parent' are incompatible.
Type 'Promise<Element | Browser | MultiRemoteBrowser>' is not assignable to type 'Element | Browser'.
65 const message = enhanceError(el, !isNot, pass, this, verb, expectation, attribute, {})
~~
src/matchers/element/toHaveAttribute.ts:87:52 - error TS2345: Argument of type 'WdioElementMaybePromise' is not assignable to parameter of type 'ChainablePromiseElement'.
Type 'Element' is not assignable to type 'ChainablePromiseElement'.
Types of property 'elementId' are incompatible.
Type 'string' is not assignable to type 'Promise<string>'.
87 ? await toHaveAttributeAndValue.call(this, received, attribute, value, options)
~~~~~~~~
src/matchers/element/toHaveClass.ts:87:47 - error TS2345: Argument of type 'Element' is not assignable to parameter of type 'ChainablePromiseElement'.
Types of property 'elementId' are incompatible.
Type 'string' is not assignable to type 'Promise<string>'.
87 return toHaveAttributeAndValue.call(this, el, 'class', className, {
~~
src/matchers/element/toHaveHref.ts:16:61 - error TS2345: Argument of type 'WdioElementMaybePromise' is not assignable to parameter of type 'ChainablePromiseElement'.
Type 'Element' is not assignable to type 'ChainablePromiseElement'.
Types of property 'elementId' are incompatible.
Type 'string' is not assignable to type 'Promise<string>'.
16 const result = await toHaveAttributeAndValue.call(this, el, 'href', expectedValue, options)
~~
src/matchers/element/toHaveId.ts:16:96 - error TS2345: Argument of type 'WdioElementMaybePromise' is not assignable to parameter of type 'ChainablePromiseElement'.
Type 'Element' is not assignable to type 'ChainablePromiseElement'.
Types of property 'elementId' are incompatible.
Type 'string' is not assignable to type 'Promise<string>'.
16 const result: ExpectWebdriverIO.AssertionResult = await toHaveAttributeAndValue.call(this, el, 'id', expectedValue, options)
~~
Found 6 errors.
Fixing them...
Metadata
Metadata
Assignees
Labels
No labels