我通常能够很容易地解决此错误,但是这次似乎没有任何作用。
我的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/*';
也没有。我该如何解决?
答案 0 :(得分:2)
创建一个名为run:
的声明文件,其内容如下:
shims-element-ui.d.ts