3

각도기 4.0.5에서 Typescript 2.0을 사용하도록 업그레이드 중입니다. 나는 typescript 1.8과 protractor 3.8에서 프로젝트를 업그레이드 중입니다.Typescript 2.0.0이있는 각도기

내 package.json은 다음과 같습니다 :

{ 
"dependencies": { 
"core-js": "2.2.2", 
"rxjs": "5.0.0-beta.6", 
"web-request": "^1.0.3", 
"zone.js": "0.6.12" 
}, 
"devDependencies": { 
"@types/jasmine": "^2.5.35", 
"@types/node": "^6.0.45", 
"@types/protractor": "^1.5.20", 
"@types/selenium-webdriver": "^2.53.33", 
"es6-promise": "3.1.2", 
"es6-promise-loader": "1.0.1", 
"es6-shim": "0.35.0", 
"es7-reflect-metadata": "1.6.0", 
"exports-loader": "0.6.3", 
"imports-loader": "0.6.5", 
"jasmine-reporters": "^2.2.0", 
"json-loader": "0.5.4", 
"mkdirp": "^0.5.1", 
"phantomjs-polyfill": "0.0.2", 
"phantomjs-prebuilt": "2.1.7", 
"pix-diff": "^1.0.14", 
"protractor": "4.0.5", 
"protractor-jasmine2-html-reporter": "0.0.6", 
"protractor-jasmine2-screenshot-reporter": "^0.3.2", 
"raw-loader": "0.5.1", 
"rimraf": "2.5.2", 
"ts-helpers": "1.1.1", 
"ts-node": "0.7.1", 
"tslint": "3.7.4", 
"tslint-loader": "2.1.3", 
"typedoc": "0.4.3", 
"typescript": "^2.0.0-beta", 
"underscore": "^1.8.3" 
} 

그럼 내 패키지 JSON은 다음과 같습니다

"compilerOptions": { 
    "target": "es5", 
    "module": "commonjs", 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "sourceMap": true, 
    "noEmitHelpers": true, 
    "lib": ["es6", "dom"], 
    "types":[ 
    ] 
    }, 
    "exclude": [ 
    "node_modules", 
    "typings" 
    ], 
    "filesGlob": [ 
    "./src/**/*.ts", 
    "!./node_modules/**/*.ts" 
    ], 
    "awesomeTypescriptLoaderOptions": { 
    "resolveGlobs": true, 
    "forkChecker": true, 
    "compiler": "node_modules/typescript" 
    }, 
    "compileOnSave": false, 
    "buildOnSave": false, 
    "atom": { "rewriteTsconfig": false } 
} 

내가 각도기를 실행하려고하면 내가 여기에 공유 문제의 무리 건너왔다 해당 설정으로 테스트를하면 다음과 같은 오류가 발생합니다.

node_modules\@types\selenium-webdriver\index.d.ts (12,11): Duplicate identifier 'Driver'. (2300) 
node_modules\@types\selenium-webdriver\index.d.ts (46,11): Duplicate identifier 'Options'. (2300) 
node_modules\@types\selenium-webdriver\index.d.ts (310,11): Duplicate identifier 'ServiceBuilder'. (2300) 
node_modules\protractor\typings\globals\selenium-webdriver\index.d.ts (12,11): Duplicate identifier 'Driver'. (2300) 
node_modules\protractor\typings\globals\selenium-webdriver\index.d.ts (46,11): Duplicate identifier 'Options'. (2300) 
node_modules\protractor\typings\globals\selenium-webdriver\index.d.ts (310,11): Duplicate identifier 'ServiceBuilder'. (2300) 

어떻게 해결할 수 있습니까? 모든 것이 올바르게 설정되었습니다. 나는 typescript 2.0으로 작업해야하는 각도기 4.0.5를 사용하고 있습니다.

+0

당신이 원인이되는 최소한의'* .ts' 파일을 추가 할 수 있습니다에 대한 https://github.com/suvroc/protractor-typescript-template

그것은 유용 할 수 있습니다 : 나는 typeRoots 내가 타이프 라이터 2 각도기를 구성하기위한 템플릿을 생성

{ "compilerOptions": { "target": "es5", "module": "commonjs", "emitDecoratorMetadata": true, "experimentalDecorators": true, "sourceMap": true, "noEmitHelpers": true, "lib": ["es6", "dom"], "types":[ ], "typeRoots": [ "node_modules/@types" ] }, "exclude": [ "node_modules", "node_modules/protractor/node_modules" ], "filesGlob": [ "./src/**/*.ts", "!./node_modules/**/*.ts" ], "awesomeTypescriptLoaderOptions": { "resolveGlobs": true, "forkChecker": true, "compiler": "node_modules/typescript" }, "compileOnSave": false, "buildOnSave": false, "atom": { "rewriteTsconfig": false } } 

exclude 수정 문제? 각도기에 대해서는 아무 것도 몰라요. 그러나 이것은 타입 정의에 문제가있는 것 같아서 도와 드리려고 노력할 수 있습니다. –

+0

@HuyNguyen Ok. 오늘 예제 저장소를 나중에 추가 할 것입니다. –

답변

0

protractor에서 문제를 열어주십시오. 패키지에 selenium-webdriver의 타이핑을 배포해서는 안됩니다. 당신은 단순히 각도기 당신의 버전을 업그레이드 할 수 있도록 '

// tsconfig.json 
{ 
    "exclude": [ 
    "node_modules/protractor/typings/global/selenium-webdriver" 
    ] 
} 
2

각도기가 5.x 버전 버전에 유형 선언을 제거 :

지금은이 문제를 해결 있는지 확인하기 위해이 추한 해킹 시도 다시 사용하고 문제는 사라져야합니다. 당신은 /이 버전 4.0.5에 머물하려면

, 당신은 항상 실행함으로써 webdriver 유형을 제거 할 수 있습니다

npm uninstall --save-dev @types/selenium-webdriver 
0

에 한번 이런 식으로 뭔가를 사용 할 수 있습니다. 당신이