DEV Community

Discussion on: Typescript Interface vs Class With Practical Examples

Collapse
 
lalves91 profile image
LAlves91

Hi! I believe this scenario doesn't work anymore. If I'm not mistaken, since Angular 9 or 10, you can't use Angular features (like DI, Inputs/Outputs and Lifecycle hooks) in non-annotated classes.

So, for models, I believe interfaces are the best way to go, unless you have custom behaviour/properties (kinda like transient properties in Java entities, which are calculated from base properties).

Collapse
 
ssimontis profile image
Scott Simontis

I apologize, I am not familiar with Angular and meant my comment as a general note for ES6/TypeScript. I appreciate your insight on Angular mechanics!

Thread Thread
 
lalves91 profile image
LAlves91 • Edited

Heey, no need to apologize! It's all about sharing knowledge! Cheers!