解决angular11打包报错Type 'Event' is missing the following properties from type 'any[]': ...Type 'Event' is not assignable to type 'string'

出现这种情况,需要检查一下以下事项

1.ts类型声明和html里写的是否一致

1.1举例如下,子组件代码需要注意事项,子组件调用父组件方法,点击传参给父组件,在父组件触发一些时间,当前this指向是父组件的this

<button  (click)="sentToParent(data)">点击传参给父组件,在父组件触发一些时间,当前this指向是父组件的this</button>

 @Input()
  public childObjData = {  
    a: '',
    b: '',
    c: [],
    d: [],
    e: []
  }
  @Output()
  private outer : EventEmitter<any> = new EventEmitter(); // 注意此处的类型声明格式

  sentToParent(e) {
    // this.bottomTable.pageNo = e
    this.outer.emit(e)
  }

1.2父组件传参给子组件

<child-component class="my-child-component" [childObjData]="sendToChildObjData"  (outer)="fromChildEvent($event)"></child-component>
  
  
  sendToChildObjData = { 
    a: '',
    b: '',
    c: [],
    d: [],
    e: []
  }
  
  
  fromChildEvent(e) {
    //  console.log(e)
    //  此处的this是父组件的this
    this.XXXX()
  }

2.父子组件传参,注意格式

下面是父组件的,注意一下传参的() 和 [],不要写错了

 <child-component class="my-child-component" [childObjData]="childObjData"  (outer)="childEent($event)"></child-component>

3.检查一下VScode控制台里PROBLEMS里有没有一些问题没有处理的~~