简体   繁体   中英

Angular 12 / Typescript issue with type never

I am using Angular 12 and this code below is complaining.

this.recorder.ondataavailable = (event: { data: any; }) => {
  this.recordedChunks.push(event.data);
};

Typescript is giving me this error:

Argument of type 'any' is not assignable to parameter of type 'never'.ts(2345)
(parameter) event: {
    data: any;
}

All you have to do is define your result as a string array, like the following:

data : any[];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM