【发布时间】:2017-02-12 03:54:09
【问题描述】:
错误 TS2314:在我的 app.component.ts 页面中升级 ionic 2.1.0 时,通用类型“类型”需要 1 个类型参数。
【问题讨论】:
标签: angular typescript ionic2
错误 TS2314:在我的 app.component.ts 页面中升级 ionic 2.1.0 时,通用类型“类型”需要 1 个类型参数。
【问题讨论】:
标签: angular typescript ionic2
所需的类型参数是什么?
当某些东西需要通用但未提供时。例如
class Foo<T>{
data:T
}
class Bar extends Foo { } // Missing generic argument
提供通用参数,例如
class Foo<T>{
data:T
}
class Bar extends Foo<number> { }
【讨论】:
public rootPage: Type<string>; public pages: Array<{title: string, component: Type<string>}> 我想给什么而不是字符串?