Interface based programming with TypeScript, Angular 2 & SystemJS

前端 未结 4 1622
抹茶落季
抹茶落季 2021-01-05 05:22

I\'m currently trying to clean up some code in order to program against interfaces rather than against implementations but can\'t figure out how to.

To be more speci

4条回答
  •  逝去的感伤
    2021-01-05 06:02

    Any practical ideas how I can use interface based programming w/ TypeScript & Angular 2

    Interfaces are erased at runtime. In fact decorators don't support interfaces either. So you are better off using something that does exist at runtime (i.e. implementations).

提交回复
热议问题