web-dev-qa-db-ja.com

TS2440:インポート宣言が 'ProtractorPlugin'のローカル宣言と競合しています

こんにちは私は簡単な分度器テスト(新しいprotracotorに)を実行しようとしていますが、このエラーが発生し続けます。以下は、package.jsonです。

"devDependencies": {
    "@angular-devkit/build-angular": "~0.803.8",
    "@angular/cli": "~8.3.8",
    "@angular/compiler-cli": "~8.2.9",
    "@angular/language-service": "~8.2.9",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "12.12.7",
    "codelyzer": "^5.0.0",
    "husky": "^3.0.9",
    "jasmine-core": "~3.4.0",
    "jasmine-reporters": "^2.3.2",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "karma-junit-reporter": "^2.0.1",
    "protractor": "~5.4.0",
    "puppeteer": "^2.0.0",
    "ts-node": "~7.0.0",
    "tslint": "^5.15.0",
    "TypeScript": "~3.6.4"
  }
6
user4391664

ダウングレードしたくない場合は、この方法でインポートを修正できます(分度器5.4.2)。

import { ElementHelper, ProtractorBrowser } from './browser';
import { ElementArrayFinder, ElementFinder } from './element';
import { ProtractorExpectedConditions } from './expectedConditions';
import { ProtractorBy } from './locators';
import { Ptor } from './ptor';
export { ActionSequence, Browser, Builder, Button, Capabilities, Capability, error, EventEmitter, FileDetector, Key, logging, promise, Session, until, WebDriver, WebElement, WebElementPromise } from 'Selenium-webdriver';
export { ElementHelper, ProtractorBrowser } from './browser';
export { Config } from './config';
export { ElementArrayFinder, ElementFinder } from './element';
export { ProtractorExpectedConditions } from './expectedConditions';
export { Locator, ProtractorBy } from './locators';
export { PluginConfig, ProtractorPlugin } from './plugins';
export { Ptor } from './ptor';
export { Runner } from './runner';
export declare let utils: {
    firefox: any;
    http: any;
    remote: any;
};
export declare let Command: any;
export declare let CommandName: any;
export declare let protractor: Ptor;
export declare let browser: ProtractorBrowser;
export declare let $: (search: string) => ElementFinder;
export declare let $$: (search: string) => ElementArrayFinder;
export declare let element: ElementHelper;
export declare let By: ProtractorBy;
export declare let by: ProtractorBy;
export declare let ExpectedConditions: ProtractorExpectedConditions;

基本的に、私たちが取り除く必要のある重複インポートがあります。あなたがパッチを持っている添付:

diff -r d5e827235972 yf/src/myapp/node_modules/protractor/built/index.d.ts
--- a/yf/src/myapp/node_modules/protractor/built/index.d.ts Sun Jan 19 20:49:39 2020 +0100
+++ b/yf/src/myapp/node_modules/protractor/built/index.d.ts Sun Jan 19 21:13:41 2020 +0100
@@ -2,7 +2,6 @@
 import { ElementArrayFinder, ElementFinder } from './element';
 import { ProtractorExpectedConditions } from './expectedConditions';
 import { ProtractorBy } from './locators';
-import { PluginConfig, ProtractorPlugin } from './plugins';
 import { Ptor } from './ptor';
 export { ActionSequence, Browser, Builder, Button, Capabilities, Capability, error, EventEmitter, FileDetector, Key, logging, promise, Session, until, WebDriver, WebElement, WebElementPromise } from 'Selenium-webdriver';
 export { ElementHelper, ProtractorBrowser } from './browser';
@@ -10,10 +9,9 @@
 export { ElementArrayFinder, ElementFinder } from './element';
 export { ProtractorExpectedConditions } from './expectedConditions';
 export { Locator, ProtractorBy } from './locators';
+export { PluginConfig, ProtractorPlugin } from './plugins';
 export { Ptor } from './ptor';
 export { Runner } from './runner';
-export declare type PluginConfig = PluginConfig;
-export declare type ProtractorPlugin = ProtractorPlugin;
 export declare let utils: {
     firefox: any;
     http: any;
1
Yennefer

私の場合、問題はコンポーネントへの誤ったインポートが原因でした。

私はこれを間違って書いた

import { EventEmitter } from 'protractor';

以下のインポートの代わりに:

import { EventEmitter } from '@angular/core';
0
Vivek Natarajan