Protractor: Tyedefs: 'AbstractExtendedWebDriver' incorrectly extends interface 'ExtendedWebDriver'

Created on 30 Jun 2017  Â·  9Comments  Â·  Source: angular/protractor

Bug report

  • Node Version: 7.9.0
  • Protractor Version: 5.1.2
  • Operating System and Version Windows 10

I recently upgrade a project from Typescript 2.3.x to 2.4.1 and now I get this error TS2430 about the typedefs in \node_modules\protractor\built\browser.d.ts

Interface 'AbstractExtendedWebDriver' incorrectly extends interface 'ExtendedWebDriver'

  Types of property 'controlFlow' are incompatible.
    Type '() => promise.ControlFlow' is not assignable to type '() => promise.ControlFlow'. Two different types with this name exist, but they are unrelated.
      Type 'promise.ControlFlow' is not assignable to type 'promise.ControlFlow'. Two different types with this name exist, but they are unrelated.
        Types of property 'execute' are incompatible.
          Type '<T>(fn: () => T | promise.Promise<T>, opt_description?: string | undefined) => promise.Promise<T>' is not assignable to type '<T>(fn: () => T | promise.Promise<T>, opt_description?: string | undefined) => promise.Promise<T>'. Two different types with this name exist, but they are unrelated.
            Types of parameters 'fn' and 'fn' are incompatible.
              Type 'T | promise.Promise<T>' is not assignable to type 'T | promise.Promise<T>'. Two different types with this name exist, but they are unrelated.
                Type 'Promise<T>' is not assignable to type 'T | Promise<T>'.
                  Type 'promise.Promise<T>' is not assignable to type 'promise.Promise<T>'. Two different types with this name exist, but they are unrelated.
                    Types of property 'then' are incompatible.
                      Type '<R>(opt_callback?: ((value: T) => R | promise.IThenable<R>) | undefined, opt_errback?: ((error: a...' is not assignable to type '<R>(opt_callback?: ((value: T) => R | promise.IThenable<R>) | undefined, opt_errback?: ((error: a...'. Two different types with this name exist, but they are unrelated.
                        Types of parameters 'opt_callback' and 'opt_callback' are incompatible.
                          Type 'R | promise.IThenable<R>' is not assignable to type 'R | promise.IThenable<R>'. Two different types with this name exist, but they are unrelated.
                            Type 'IThenable<R>' is not assignable to type 'R | IThenable<R>'.
                              Type 'promise.IThenable<R>' is not assignable to type 'promise.IThenable<R>'. Two different types with this name exist, but they are unrelated.
                                Types of property 'then' are incompatible.
                                  Type '<R>(opt_callback?: ((value: R) => R | promise.IThenable<R>) | undefined, opt_errback?: ((error: a...' is not assignable to type '<R>(opt_callback?: ((value: R) => R | promise.IThenable<R>) | undefined, opt_errback?: ((error: a...'. Two different types with this name exist, but they are unrelated.
                                    Type 'Promise<R | IThenable<R>>' is not assignable to type 'Promise<R>'.
                                      Types of property 'then' are incompatible.
                                        Type '<R>(opt_callback?: ((value: R | IThenable<R>) => R | IThenable<R>) | undefined, opt_errback?: ((e...' is not assignable to type '<R>(opt_callback?: ((value: R) => R | IThenable<R>) | undefined, opt_errback?: ((error: any) => a...'.
                                          Types of parameters 'opt_callback' and 'opt_callback' are incompatible.
                                            Types of parameters 'value' and 'value' are incompatible.
                                              Type 'R | IThenable<R>' is not assignable to type 'R'.
                                                Type 'IThenable<R>' is not assignable to type 'R'.

Most helpful comment

It recently came to my attention that there are 2 new compiler options in TS 2.4.x

"noStrictGenericChecks": true

"Disable strict checking of generic signatures in function types."

"skipLibCheck": true

"Skip type checking of all declaration files (*.d.ts)."

view all options here


i think that all one would need to do is set "skipLibCheck": true and then bad typedefs won't interfere any more

All 9 comments

Not sure if it's related, but webdriver-js-extender was made into a dependency for 5.0, and it references an older version of selenium-webdriver..

https://github.com/angular/webdriver-js-extender/blob/master/package.json#L26

>npm ls selenium-webdriver
`-- [email protected]
+-- [email protected]
`-- [email protected]
    `-- [email protected]

@chrismbarr did you find a solution for this? After 13+ hours and many attempts it's still lingering

My only solution was to keep typescript at the previous version. We had other unrelated issues as well.

On Jul 18, 2017, at 11:23 PM, Thomas Cayne notifications@github.com wrote:

@chrismbarr did you find a solution for this? After 8 hours and many attempts it's still lingering

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

what is the workaround if we still want to use typescript 2.4.1 ?

It recently came to my attention that there are 2 new compiler options in TS 2.4.x

"noStrictGenericChecks": true

"Disable strict checking of generic signatures in function types."

"skipLibCheck": true

"Skip type checking of all declaration files (*.d.ts)."

view all options here


i think that all one would need to do is set "skipLibCheck": true and then bad typedefs won't interfere any more

So here's what I've done so far:

What should happen... the typings in Protractor should work and they should be properly extended. If you plan to use the latest @types/selenium-webdriver and use "skipLibCheck": true, that is a nice temporary fix. The real fix should be to have type checking during transpile so you get the benefits of TypeScript static analysis.

Just ran into this when I installed typescript 2.7.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

smarts picture smarts  Â·  3Comments

tmeneau picture tmeneau  Â·  3Comments

psech picture psech  Â·  3Comments

amedvedjev picture amedvedjev  Â·  3Comments

mvolkmann picture mvolkmann  Â·  3Comments