关于以下代码,我有两个问题:
当我编译它时,我收到警告/错误“无法将 'any[]' 转换为 'Array'”。那是因为
public songPaths: Array = []
不合法,我应该去public songPaths: any = []
吗?是否
Object
有合适的默认值public song:Object = new Audio()
?
例子:
'use strict';
class Boombox{
constructor(public track: number, public codec: string, public song:Object = new Audio(), public currentTime: number = 0, public playing:bool = false, public titles: any = [], public songPaths: Array = []){
}
}