Menu

Post image 1
Post image 2
1 / 2
0

This One Change Would Transform Angular Forever

DEV Community·Romain Geffrault·about 1 month ago
#l7Zd1lBW
Reading 0:00
15s threshold

Like it or not, building a component this way would let Angular go full Super Saiyan. Why? Because unlike decorators, functions give you full control over typing. And why does that matter? With this approach, I can understand all of a component’s dependencies just by looking at its type. I can clearly see that ApiService and Router are direct dependencies of the component. But there can also be indirect dependencies coming from things like JsonPipe or StatusComponent. And why is that interesting? Because it massively simplifies test setup—especially in large, messy applications. This change would also enable strongly typed routes (which already exist), along with type-safe inputs bound to route parameters. It would even allow you to catch missing service injections at compile time. And that would be incredible. Angular’s DI system is already excellent—this would take it to the next level. And the best part? All of these benefits would only require minimal changes.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More