2017-09-29 6 views
0

活字体+ Vueの+要素-UIは、私はVueの+のtypescriptですと要素-UIを使用するにはどうすればよい

は要素-UIには種類がありませんので、私はそれをインポートするとき

import Vue from 'vue'; 
import Element from 'element-ui' 

私はエラーを取得する

Could not find a declaration file for module 'element-ui'. '/home/andres/Code/cdr/frontend/node_modules/element-ui/lib/element-ui.common.js' implicitly has an 'any' type. 

どうすれば対処できますか?

// in element-ui.d.ts 

declare module "element-ui"; 

これは、あなたがanyとして入力するelement-uiからインポートものになります:

+0

あなたのタイスクリプト設定を追加できますか? – imcvampire

答えて

2

回避策としては、単にモジュールをカスタムタイピングファイルを作成し、宣言することができます。もちろん、element-ui.d.tsにタイプ定義を追加して、必要に応じてタイピングすることもできます。

see how to write your own types hereです。

関連する問題