2017-08-02 19 views
6

मैं @ प्रकार/प्रतिक्रिया-डोम और टाइपप्रति के साथ-साथ और @ प्रकार/प्रतिक्रिया @ प्रकार/उल्का स्थापित किया है, लेकिन जब मैं कमांड लाइन से typechecker चलाने का प्रयास मैं नीचे त्रुटिnode_modules/@ प्रकार/प्रतिक्रिया-डोम/में त्रुटि .... बाद में परिवर्तनीय घोषणाओं में एक ही प्रकार होना चाहिए। चर 'एक'

आप कर सकते हैं पाने के त्रुटि को पुन: उत्पन्न करें और यहां मेरी सभी कॉन्फ़िगरेशन देखें: https://github.com/Falieson/react15-meteor1.5

आपकी सहायता के लिए धन्यवाद!

$ meteor npm run type:client 

> [email protected] type:client /Users/sjcfmett/Private/ReactMeteorExample 
> tslint -p ./tsconfig.json --type-check './client/**/*.{ts,tsx}' 

Error at node_modules/@types/react-dom/node_modules/@types/react/index.d.ts:3422:13: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>', but here has type 'DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>'. 
Error at node_modules/@types/react-dom/node_modules/@types/react/index.d.ts:3423:13: Subsequent variable declarations must have the same type. Variable 'abbr' must be of type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>', but here has type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>'. 
Error at node_modules/@types/react-dom/node_modules/@types/react/index.d.ts:3424:13: Subsequent variable declarations must have the same type. Variable 'address' must be of type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>', but here has type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>'. 
Error at node_modules/@types/react-dom/node_modules/@types/react/index.d.ts:3425:13: Subsequent variable declarations must have the same type. Variable 'area' must be of type 'DetailedHTMLProps<AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>', but here has type 'DetailedHTMLProps<AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>'. 
... (shortened) 

package.json (संदर्भ के लिए)

{ 
    "name": "react-meteor-example", 
    "version": "0.1.0", 
    "private": true, 
    "scripts": { 
    "start": "meteor run", 
    "lint:client": "tslint --fix -c ./tslint.json -p ./tsconfig.json './client/**/*.{ts,tsx}'", 
    "lint:imports": "tslint --fix -c ./tslint.json -p ./tsconfig.json './imports/**/*.{ts,tsx}'", 
    "lint:server": "tslint --fix -c ./tslint.json -p ./tsconfig.json './server/**/*.ts'", 
    "lint": "npm run lint:client && npm run lint:server && npm run lint:imports", 
    "type:imports": "tslint -p ./tsconfig.json --type-check './imports/**/*.{ts,tsx}'", 
    "type:client": "tslint -p ./tsconfig.json --type-check './client/**/*.{ts,tsx}'", 
    "type:server": "tslint -p ./tsconfig.json --type-check './server/**/*.ts'", 
    "type": "npm run type:client && npm run type:server && npm run type:imports", 
    "precommit": "npm run lint && npm run type" 
    }, 
    "dependencies": { 
    "babel-runtime": "^6.20.0", 
    "meteor-node-stubs": "~0.2.4", 
    "react": "^15.6.1", 
    "react-dom": "^15.6.1" 
    }, 
    "devDependencies": { 
    "@types/meteor": "^1.4.2", 
    "@types/react": "^15.6.0", 
    "@types/react-dom": "^15.5.1", 
    "babel-preset-react": "^6.24.1", 
    "babel-preset-stage-1": "^6.24.1", 
    "husky": "^0.14.3", 
    "tslint": "^5.5.0", 
    "tslint-react": "^3.1.0", 
    "typescript": "^2.4.2" 
    } 
} 

उत्तर

4

16 बीटा प्रतिक्रिया के लिए प्रकार 'नवीनतम' प्रतिक्रिया प्रकार के रूप में प्रकाशित किया गया है।

नया संस्करण प्रतिक्रिया के उन हिस्सों के लिए परिभाषाओं को हटा देता है जिन्हें प्रतिक्रिया 16 (जैसे React.DOM) में हटा दिया गया है, जो अपेक्षित है।

दुर्भाग्यवश, प्रतिक्रिया 16 बीटा के लिए इन प्रकारों का प्रकाशन @nxt (प्रतिक्रिया के रूप में) के बजाय npm में @latest (डिफ़ॉल्ट) टैग पर किया गया था। https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18708

आप विशेष रूप से एक विशेष रिलीज (npm install --save @types/[email protected]), लेकिन @ प्रकार में निर्भरता/प्रतिक्रिया-डोम @ प्रकार/प्रतिक्रिया सेट किया गया है के लिए लक्षित कर की कोशिश कर सकते हैं:

मैं DefinitelyTyped के साथ एक खुली मुद्दा (# 18,708) यहाँ "*", जो कि @ प्रकार/प्रतिक्रिया @ नवीनतम @ अभी भी डाउनलोड होने का कारण बनता है, जिससे आप अपने node_modules निर्देशिका के विभिन्न स्थानों में एकाधिक संस्करण प्राप्त कर सकते हैं।

हमें इसे हल करने के लिए कुछ मैन्युअल कार्य करना पड़ रहा है। उम्मीद है कि @ प्रकार/प्रतिक्रिया बनाए रखने वाले लोग जल्द ही इसे ठीक करेंगे।

0

मैं यार्न का उपयोग कर रहा है, और rm -rf node_modules && rm yarn.lock && yarn install

+0

चलाकर इस तय बस ऐसे ही लोगों को जानते हैं तो - अगर आप एक पैकेज प्रबंधक के रूप में यार्न पर निर्भर कर रहे हैं तो इस आदेश को 'yarn' का पूरा उद्देश्य पर्दाफाश किया गया है। हालांकि यह निश्चित रूप से इस मुद्दे को हल करता है :) दूसरी तरफ, आप बस इसके बजाय 'npm install' चला सकते हैं – Dethariel

संबंधित मुद्दे