protractor: TS2440: Import declaration conflicts with local declaration of 'PluginConfig'.
Hi Sir!
Bug report I am getting following below error :
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’.
- Node Version:
10.5.0
- Protractor Version:
~5.1.2
- Angular Version:
^4.2.4
- Browser(s):
any
- Operating System and Version
Windows 10
- Your protractor configuration file
const { SpecReporter } = require(‘jasmine-spec-reporter’);
exports.config = { allScriptsTimeout: 11000, specs: [ ‘./e2e/**/*.e2e-spec.ts’ ], capabilities: { ‘browserName’: ‘chrome’ }, directConnect: true, baseUrl: ‘http://localhost:4200/’, framework: ‘jasmine’, jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 30000, print: function() {} }, onPrepare() { require(‘ts-node’).register({ project: ‘e2e/tsconfig.e2e.json’ }); jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); } };
- Steps to reproduce the bug - npm run build fail
Feature Request Please help me to resolve
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 15
- Comments: 27 (1 by maintainers)
Commits related to this issue
- test(docs-infra): compile only app for examples with no e2e With TS 3.7, these examples were running into the error below (e.g. on https://circleci.com/gh/angular/angular/574906#tests/containers/0): ... — committed to andrius-pra/angular by filipesilva 4 years ago
- test(docs-infra): compile only app for examples with no e2e With TS 3.7, these examples were running into the error below (e.g. on https://circleci.com/gh/angular/angular/574906#tests/containers/0): ... — committed to andrius-pra/angular by filipesilva 4 years ago
- test(docs-infra): compile only app for examples with no e2e With TS 3.7, these examples were running into the error below (e.g. on https://circleci.com/gh/angular/angular/574906#tests/containers/0): ... — committed to andrius-pra/angular by filipesilva 4 years ago
- test(docs-infra): compile only app for examples with no e2e With TS 3.7, these examples were running into the error below (e.g. on https://circleci.com/gh/angular/angular/574906#tests/containers/0): ... — committed to andrius-pra/angular by filipesilva 4 years ago
- test(docs-infra): compile only app for examples with no e2e (#33717) With TS 3.7, these examples were running into the error below (e.g. on https://circleci.com/gh/angular/angular/574906#tests/contai... — committed to angular/angular by filipesilva 4 years ago
- test(docs-infra): compile only app for examples with no e2e (#33717) With TS 3.7, these examples were running into the error below (e.g. on https://circleci.com/gh/angular/angular/574906#tests/contai... — committed to angular/angular by filipesilva 4 years ago
Today I have downgraded the typescript version from 3.7.x to 3.6.x.,It is working fine . Thank you mattcasey
May not be the best solution for everyone, but you should be able to fix this by adding the following in tsconfig.json:
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! 😃
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
Update types/node dependency
npm install -g @types/node@8
Make sure that types/node is listed in both devDependencies and dependencies
"dependencies": { ... "@types/node": "^8.10.59", ... }, "devDependencies": { ... "@types/node": "^8.10.59", ... }
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.
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
This was fixed in https://github.com/angular/protractor/pull/5326. We are working on getting a patch release out.
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
fyi: in the meantime using tsc compiler option
"skipLibCheck": true
should be a sufficient workaround for those affected by this issue.@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.
Same issue and when I downgraded to 3.6.4 it worked.
For me it was VSCode’s auto-import, that imported
EventEmitter
fromProtractor
instead of@angular/core
. Fixing this fixed the issue for me.@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?