有没有办法从基类转换为派生类?
class A{}
class B extends A{}
const b = new B()
const a:A = b //casts to base class ok
const b2:B = a //Error: Type 'A' is not assignable to type 'B'
有没有办法从基类转换为派生类?
class A{}
class B extends A{}
const b = new B()
const a:A = b //casts to base class ok
const b2:B = a //Error: Type 'A' is not assignable to type 'B'