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
{{ message }}
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
TS2440: Import declaration conflicts with local declaration of 'PluginConfig'. #5348
ERROR in [at-loader] ./node_modules/protractor/built/index.d.ts:5:10
TS2440: Import declaration conflicts with local declaration of 'PluginConfig'.
ERROR in [at-loader] ./node_modules/protractor/built/index.d.ts:5:24
TS2440: Import declaration conflicts with local declaration of 'ProtractorPlugin'.
Reacted by Paul L Ferguson, ZoltanDobrovolni, ugeng, Hanspeter Stalder, vitoqqq, lotrgollum87, Jon Wallsten, Matthew Erwin, Yurii But, dipaligeradah and 5 more
Edit: I should clarify that I work on the Typescript team, not the Angular team. I talked to some team members who said they would try to publish a new 5.* version, but I believe the process is not simple.
Reacted by Matt Casey, daniel, Venkat, Sam Padgett, fauxsaurus and lotrgollum87
Today I have downgraded the typescript version from 3.7.x to 3.6.x.,It is working fine . Thank you mattcasey
Reacted by Szikszai László, David Mihal, Loc Truong, Venkat, praveendvd, Axel Gendillard, Karl Tarvas, guziakas, Isaac Cobos Galarza, Taylor1990 and 2 more
Reacted by Prime, Kyle Pittman, Srisri Gokanapudy, Tyler Lu, matt burnett, lotrgollum87, Matthew Erwin, Lane Schmidt, kwanso-nadeem, Oscar Castaneda and 3 more
Thanks for clarifying @sandersn; that was going to be my next question. We don't rely on flow control and I tried updating to 6.0.0 but even that published package doesn't seem to have your fix yet. It'd be great if someone from the team could comment here: are we talking a few days, a few months, or more?
Edit: I'd offer to help but it seems like the hold-up is "just" in releasing a new version :)
@mattcasey Could you describe in a bit more detail how your current fix works? Just a copied index.d.ts file with the correct export paths and then use the path mapping to map protractor to the new file?
@woppa684 my fix is essentially to create my own types for Protractor and tell Typescript to ignore the one inside of node_modules. My protractor.d.ts (located in my project at test-e2e/protractor.d.ts) file looks like this:
// Note: This stub exists to override Protractor types which are incompatible with TS 3.7 as of 5.4.2 and 6.0.0
declare module 'protractor' {
let browser: any;
let element: any;
let by: any;
let ExpectedConditions: any;
let until: any;
let Key: any;
}
I'm having this problem on devops with Angular. This just started happening. I went back and grabbed a package.json and package-lock.json from a time I know it worked.
I upgraded Angular. I tried several different typescript versions. It works on my local computer, but not on devops. It's only the vs build portion that's failing. The npm/ng stuff runs just fine.
Everything works completely on my system. https://developercommunity.visualstudio.com/content/problem/855096/npm-ng-suddenly-not-working-conflict-pluginconfig.html
May not be the best solution for everyone, but you should be able to fix this by adding the following in tsconfig.json:
"skipLibCheck": true
Reacted by Raj Kumar, Tyler Lu, Patrick Michalina, Henry Cho, Oleksii, Patrick, Lane Schmidt, David P. Hochman, Gabi Carballo, FILIP KALOUSEK and 6 more
Reacted by Mohamed Jihed Riahi, Chris Weber and AxelDivin
In case this happen with any module using typescript 3.7.2 you can use the "as" statement. import { module as otherModuleName } from "./module"
Or you could export the module as default so you can use a different variable name
@anicarrr , Could you please provide an example for second answer u provided?
I mean exporting like:
export default myModule
so then when you import it you can just use whatever name you want, like:
ERROR in [at-loader] ./node_modules/protractor/built/index.d.ts:5:10
TS2440: Import declaration conflicts with local declaration of 'PluginConfig'.
ERROR in [at-loader] ./node_modules/protractor/built/index.d.ts:5:24
TS2440: Import declaration conflicts with local declaration of 'ProtractorPlugin'.
I had this issue in my angular app and I am able to resolve it via removing the protractor import statement which is automatically added by the suggestions.
Like:
import { element } from 'protractor'
import { promise } from 'protractor'
Just remove them I will run as expected.
Mine worked, I hope your code work too.
Regards,
Nishit Zinzuvadiya
Reacted by Aljaž Mur Eržen, digital-tcbs, Christian Rausch, Anthony Rich and Mahmoud Iblasi
Sometimes the TypeScript compiler just blames errors on someone else's smoking gun.
I got the OP's exact error message today while working on .spec.ts unit test files. Since I didn't need Protractor for unit tests I temporarily uninstalled it with npm uninstall protractor which then caused TypeScript to throw the real error:
ERROR in src/app/.../...spec.ts:12:30 - error TS2307: Cannot find module 'protractor'.
12 import { EventEmitter } from 'protractor';
The cause was Visual Studio Code had inexplicably created this automatic import statement instead of the normal one, import { EventEmitter } from '@angular/core';
I had this issue in my angular app and I am able to resolve it via removing the protractor import statement which is automatically added by the suggestions.
Like:
import { element } from 'protractor'
import { promise } from 'protractor'
Just remove them I will run as expected.
Mine worked, I hope your code work too.
Regards,
Nishit Zinzuvadiya
For me it was VSCode's auto-import, that imported EventEmitter from Protractor instead of @angular/core. Fixing this fixed the issue for me.
Activity
josh-s-g commentedon Nov 6, 2019
As of today I'm getting the same issue (with Protractor 5.4.2 and Angular 8)
DanikRaikhlin commentedon Nov 6, 2019
Same issue here with Protractor 5.4.2 and Angular 8
mattcasey commentedon Nov 6, 2019
I ran into this today while upgrading our Typescript version. We're on AngularJS and it occurs for both Protractor 5.4.1 and 5.4.2. I do not get the error on Typescript 3.6.4 (3.6.x), but I do with Typescript 3.7.2 (3.7.x). I believe it's related to this breaking change: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#local-and-imported-type-declarations-now-conflict
Please fix; we need nullish coalescing! :)
akwiatek commentedon Nov 6, 2019
Same problem here. My project is at Protractor 5.4.2 and we would like to migrate to TypeScript 3.7 .
It would be great to backport the fix (it surely works):
89fbf75
37bef24
from master to 5.4.2
5.4.2 is the latest version available at npmjs.com .
6.0.0 contains breaking changes, so it is not good for my project.
( https://github.com/angular/protractor/blob/6.0.0/CHANGELOG.md )
CC: @sandersn @heathkit
sandersn commentedon Nov 6, 2019
Duplicate of #5325
Edit: I should clarify that I work on the Typescript team, not the Angular team. I talked to some team members who said they would try to publish a new 5.* version, but I believe the process is not simple.
SACHINBN commentedon Nov 7, 2019
Today I have downgraded the typescript version from 3.7.x to 3.6.x.,It is working fine . Thank you mattcasey
mattcasey commentedon Nov 7, 2019
Thanks for clarifying @sandersn; that was going to be my next question. We don't rely on flow control and I tried updating to 6.0.0 but even that published package doesn't seem to have your fix yet. It'd be great if someone from the team could comment here: are we talking a few days, a few months, or more?
Edit: I'd offer to help but it seems like the hold-up is "just" in releasing a new version :)
Edit 2: Since the rest of our system has moved on to TS 3.7, the lesser of two evils for me was to override the types from protractor for now by linking to a custom .d.ts file in our tsconfig: https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping
woppa684 commentedon Nov 13, 2019
@mattcasey Could you describe in a bit more detail how your current fix works? Just a copied index.d.ts file with the correct export paths and then use the path mapping to map protractor to the new file?
ayoubde commentedon Nov 13, 2019
Update types/node dependency
npm install -g @types/node@8Make sure that types/node is listed in both devDependencies and dependencies
"dependencies": { ... "@types/node": "^8.10.59", ... }, "devDependencies": { ... "@types/node": "^8.10.59", ... }anicarrr commentedon Nov 14, 2019
In case this happen with any module using typescript 3.7.2 you can use the "as" statement.
import { module as otherModuleName } from "./module"Or you could export the module as default so you can use a different variable name
benbreaker0412 commentedon Nov 24, 2019
It put "typescript": "~3.6" to file package.json then run "npm install" on terminal and it worked for me. Thanks!
VenkatSaripilli commentedon Nov 24, 2019
Same issue and when I downgraded to 3.6.4 it worked.
SamuelMarks commentedon Nov 26, 2019
Same issue here, I had to
npm uninstall -g typescriptso that the local version oftscwould take priority. I could've messed withPATHinstead…mattcasey commentedon Nov 26, 2019
@woppa684 my fix is essentially to create my own types for Protractor and tell Typescript to ignore the one inside of node_modules. My
protractor.d.ts(located in my project attest-e2e/protractor.d.ts) file looks like this:And then in tsconfig:
This allows me to use Typescript 3.7 with the downside that protractor methods are no longer type-safe.
tomyam1 commentedon Dec 6, 2019
An alternative solution we used is to create a modified build of protractor with the fixes in #5326
We than temporarily use it instead of protractor
bluebaroncanada commentedon Dec 16, 2019
I'm having this problem on devops with Angular. This just started happening. I went back and grabbed a package.json and package-lock.json from a time I know it worked.
I upgraded Angular. I tried several different typescript versions. It works on my local computer, but not on devops. It's only the vs build portion that's failing. The npm/ng stuff runs just fine.
Everything works completely on my system.
https://developercommunity.visualstudio.com/content/problem/855096/npm-ng-suddenly-not-working-conflict-pluginconfig.html
lucky1895 commentedon Dec 19, 2019
@anicarrr , Could you please provide an example for second answer u provided?
JonWallsten commentedon Dec 23, 2019
May not be the best solution for everyone, but you should be able to fix this by adding the following in tsconfig.json:
anicarrr commentedon Dec 26, 2019
I mean exporting like:
export default myModuleso then when you import it you can just use whatever name you want, like:
import whateverName from myModuletest(docs-infra): compile only app for examples with no e2e (#33717)
test(docs-infra): compile only app for examples with no e2e (#33717)
IgorMinar commentedon Jan 17, 2020
This was fixed in #5326. We are working on getting a patch release out.
IgorMinar commentedon Jan 17, 2020
fyi: in the meantime using tsc compiler option
"skipLibCheck": trueshould be a sufficient workaround for those affected by this issue.ameyasworld commentedon Jan 21, 2020
Hi SachinBN,
You need to change version of Typescript installed in project. Use below command in VS Code terminal to change version(without quotes).
"npm install -g typescript@3.6.2"
Once done, please check version of typescript in your project on VS Code, using below command
"tsc -v"
It should show 3.6.2. Please use same version in package.json file. Once version is changed to 3.6.2 execute "tsc" again, error should be gone.
Hope this helps.
Regards,
Ameya
Nishit-Zinzuvadiya commentedon Jan 28, 2020
I had this issue in my angular app and I am able to resolve it via removing the protractor import statement which is automatically added by the suggestions.
Like:
import { element } from 'protractor'
import { promise } from 'protractor'
Just remove them I will run as expected.
Mine worked, I hope your code work too.
Regards,
Nishit Zinzuvadiya
Serhioromano commentedon Mar 30, 2020
Latest node and NPM.
My file
And I have same error
antman2 commentedon Aug 25, 2020
Sometimes the TypeScript compiler just blames errors on someone else's smoking gun.
I got the OP's exact error message today while working on .spec.ts unit test files. Since I didn't need Protractor for unit tests I temporarily uninstalled it with
npm uninstall protractorwhich then caused TypeScript to throw the real error:The cause was Visual Studio Code had inexplicably created this automatic import statement instead of the normal one,
import { EventEmitter } from '@angular/core';nikita-fuchs commentedon Sep 10, 2020
For me it was VSCode's auto-import, that imported
EventEmitterfromProtractorinstead of@angular/core. Fixing this fixed the issue for me.