问题描述
将@stencil/plugin-eslint
添加到我的eslint配置extends
部分后,eslint已开始引发以下错误:
Oops! Something went wrong! :(
ESLint: 7.11.0
TypeError: Cannot read property 'typeAnnotation' of undefined
解决方法
在我的媒体资源中添加类型注释可以解决此问题:
@Component({
tag: 'my-component',shadow: true,})
export class MyComponent implements ComponentWillLoad {
// @Element() host; // before
@Element() host: HTMLMyComponentElement; // after
另外,将其添加到我的tsconfig.json
-> compilerOptions
中会导致这种情况以早期错误的形式出现:
"noImplicitAny": true,