Adapted from #3275:
classGenericThingamabob<T>{constructor(privateentity: T){}add(item: T){}}classCouponInfo{privatecouponTag: {};}classSnake{privatesnakeTag: {};}varblah=newGenericThingamabob(newCouponInfo());blah.add(newSnake());// ~~~~~~~~~~~varx: CouponInfo=newSnake();// ~On the first error, I get
Argument of type 'Snake' is not assignable to parameter of type 'CouponInfo'.
Property 'couponTag' is missing in type 'Snake'
On the second, I get
Type 'Snake' is not assignable to type 'CouponInfo'.
Note that if you turned blah.add(new Snake()); into a variable assignment like var a: CouponInfo = new Snake(), you'll get the same issue.
Adapted from #3275:
On the first error, I get
On the second, I get
Note that if you turned
blah.add(new Snake());into a variable assignment likevar a: CouponInfo = new Snake(), you'll get the same issue.