Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Tyedefs: 'AbstractExtendedWebDriver' incorrectly extends interface 'ExtendedWebDriver' #4361

Closed
ChrisMBarr opened this issue Jun 30, 2017 · 9 comments

Comments

@ChrisMBarr
Copy link

ChrisMBarr commented Jun 30, 2017

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'.
@djabraham
Copy link

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
`-- protractor@5.1.1
+-- selenium-webdriver@3.0.1
`-- webdriver-js-extender@1.0.0
	`-- selenium-webdriver@2.53.3

@tobiasc
Copy link

tobiasc commented Jul 2, 2017

+1

Hardcoding typescript@2.3.4 "fixed" it

node@7.9.0 & node@8.1.3
protractor@5.1.2
mac@10.12.5

@ChrisMBarr
Copy link
Author

related: microsoft/TypeScript#3598

@thomascayne
Copy link

thomascayne commented Jul 19, 2017

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

@ChrisMBarr
Copy link
Author

ChrisMBarr commented Jul 19, 2017 via email

@ash2014
Copy link

ash2014 commented Aug 2, 2017

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

@ChrisMBarr
Copy link
Author

ChrisMBarr commented Aug 2, 2017

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

@cnishina
Copy link
Member

cnishina commented Aug 6, 2017

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.

stieler-it referenced this issue in jhipster/generator-jhipster Aug 15, 2017
jp7677 added a commit to jp7677/hellocoreclr that referenced this issue Aug 20, 2017
makmu added a commit to makmu/protractor-cucumber-typescript that referenced this issue Aug 25, 2017
@niemyjski
Copy link

Just ran into this when I installed typescript 2.7.0

@ChrisMBarr ChrisMBarr closed this as not planned Won't fix, can't repro, duplicate, stale May 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants