2016-06-08 3 views
3

TypeScript 컴파일러는 tsconfig의 입력 디렉토리를 제외했지만 react-redux 입력 파일의 오류를보고합니다.react-redux 입력 파일의 TypeScript 오류

타이프 라이터 버전 : 여기 1.8.10

오류가 나는 /home/me/dev/proj/typings/main/ambient/react-redux/index.d에서

오류를 얻고있다 .ts (64,16) : 오류 TS2314 : 일반 유형 '파견'에는 1 개의 유형 인수가 필요합니다.

오류 /home/me/dev/proj/typings/main/ambient/react-redux/index.d.ts (68,21) : 오류 TS2314 : 일반 유형 'ActionCreator'에는 1 개의 유형 인수가 필요합니다 (에스).

오류 /home/me/dev/proj/typings/main/ambient/react-redux/index.d.ts (95,13) : 오류 TS2314 : 일반 유형 'Store'에는 1 개의 유형 인수가 필요합니다 (에스).

typings.json :

{ 
    "ambientDependencies": { 
     "es6-shim": "registry:dt/es6-shim#0.31.2+20160602141504", 
     "material-ui": "registry:dt/material-ui#0.15.0+20160602140214", 
     "query-string": "registry:dt/query-string#3.0.0+20160331065456", 
     "react": "github:DefinitelyTyped/DefinitelyTyped/react/react.d.ts#f407264835650f5f38d4bb2c515a79e7a835916b", 
     "react-addons-css-transition-group": "registry:dt/react-addons-css-transition-group#0.14.0+20160316155526", 
     "react-addons-transition-group": "registry:dt/react-addons-transition-group#0.14.0+20160417134118", 
     "react-dom": "github:DefinitelyTyped/DefinitelyTyped/react/react-dom.d.ts#ca5bfe76d2d9bf6852cbc712d9f3e0047c93486e", 
     "react-redux": "registry:dt/react-redux#4.4.0+20160501125835", 
     "react-tap-event-plugin": "registry:dt/react-tap-event-plugin#0.0.0+20160226083632", 
     "require": "registry:dt/require#2.1.20+20160316155526", 
     "socket.io-client": "registry:dt/socket.io-client#1.4.4+20160317120654" 
    }, 
    "dependencies": { 
     "es6-promise": "registry:npm/es6-promise#3.0.0+20160211003958", 
     "radium": "registry:npm/radium#0.16.6+20160310030142", 
     "redux-thunk": "registry:npm/redux-thunk#2.0.0+20160525185520", 
     "webpack": "registry:npm/webpack#1.12.9+20160418172948" 
    } 
} 

tsconfig.json :

{ 
    "version": "1.8.10", 
    "compileOnSave": false, 
    "compilerOptions": { 
     "module": "commonjs", 
     "target": "es5", 
     "jsx": "react", 
     "sourceMap": true, 
     "emitDecoratorMetadata": true, 
     "experimentalDecorators": true 
    }, 
    "exclude": [ 
     "node_modules", 
     "typings" 
    ] 
} 

가 왜 제외 된 디렉토리에서 오류를보고? 이러한 오류를 제거하려면 어떻게해야합니까?

업데이트 : 마이크로

는 그의 대답에 제안, 문제는 반응-REDUX 정의 REDUX와 함께 제공되는 것들을 REDUX의 DT 정의를 사용하고하지 않는 것입니다. redux에 대한 dt 정의를 설치하면 실제로 이러한 오류가 발생하지만 내 코드는 redux와 함께 제공되는 정의 파일에 정의 된 제네릭 형식을 사용하기 때문에이 옵션은 나를위한 옵션이 아닙니다.

그럼 내 진짜 질문은 다음과 같습니다. TypeScript에서 입력 파일의 오류를보고하지 못하게하려면 어떻게해야합니까? 제외 디렉토리 중 하나 인 '타이핑'을 설정하면이 문제를 막을 수 있다고 생각했지만 그렇지 않습니다.

답변

3

react-redux에 대한 dt 정의가 dt definitions for redux에 종속되어있는 것 같습니다.이 모듈은 bundled with the redux npm 모듈과 다릅니다. 의존하는 것처럼 보입니다.

dt에서 redux의 주변 (전역) 정의를 설치하면 문제가 해결됩니다.

typings install dt~redux --global --save

된 TS 입력 공간이 지저분하다.

react-redux에 대한 dt 유형 정의를 설치하면 각 종속성을 제거하여 각자 자신을 설치하도록 강요하므로 조금 혼란 스럽습니다.

+0

답변 해 주셔서 감사합니다. 네, 맞습니다.하지만 유감스럽게도 제안 된 해결책은 제가 선택할 수있는 방법이 아닙니다. 내 질문에 업데이 트를 참조하십시오 – Dominic

+0

Btw, dt 저장소에서 redux 입력을 설치하는 주어진 명령이 나를 위해 작동하지 않았다, 필자는 입력> redux -ambient를 입력해야했습니다. – Dominic

+0

입력 1.0 버전 이전 버전 인 https://github.com/typings/typings#updating-from-0x-to-10을 사용하고있는 것 같습니다.귀하의 업데이트 된 질문에 관해서는, 나는 단지 redux에 대한 dt 입력을 사용하도록 코드를 업데이트 할 것입니다. 그렇지 않으면 dt redux 입력에 의존하는 redux redux 또는 기타 redux lib 입력에 대한 입력이 없게됩니다. –

관련 문제