我通常能够很容易地解决这个错误,但这次似乎没有任何效果。
我的main.ts
文件有这个:
import locale from 'element-ui/lib/locale/lang/en';
错误:
ERROR in /Volumes/SuperData/Sites/reelcrafter/rc-ts/src/main.ts
6:20 Could not find a declaration file for module 'element-ui/lib/locale/lang/en'. '/Volumes/SuperData/Sites/reelcrafter/rc-ts/node_modules/element-ui/lib/locale/lang/en.js' implicitly has an 'any' type.
Try `npm install @types/element-ui` if it exists or add a new declaration (.d.ts) file containing `declare module 'element-ui';`
4 | import store from './store';
5 | import ElementUI from 'element-ui';
> 6 | import locale from 'element-ui/lib/locale/lang/en';
| ^
7 | import VueDragDrop from 'vue-drag-drop';
8 | import './styles/element-setup.scss';
9 | import './bootstrap/amplify-setup';
No lint errors found
Version: typescript 3.0.1, tslint 5.11.0
在我declarations.d.ts
的根级别中,我添加了以下内容:
declare module 'element-ui';
这不能解决问题。也没有declare module 'element-ui/*';
。我如何解决它?