Ng-News 24/25: DomRef, TypeScript 5.5, Business/Render effect, State of JavaScript
The days of ElementRef might be numbered. State of JavaScript revealed its results. TypeScript 5.5 brings inferred type predicates, a conceptional split into business, and rendering effects is on the table.
RFC: DOM Interaction
In a new RFC, the Angular team proposes replacing the ElementRef type with a new one: DomRef. ElementRef encapsulates the native DOM Element. Especially UI libraries, which require direct access to the DOM, heavily depend on it.
According to Jeremy Elbourn, the switch is necessary to achieve advanced hydration techniques like streaming or partial hydration.
The community received the RFC with certain reservations.
State of JavaScript 2023
State of JavaScript, a survey with around 24,000 participants, released its results. In terms of usage, Vue took over Angular’s second place. In the category of interest, Angular rose from 20% to 23%.
TypeScript 5.5
TypeScript 5.5 was released, and it will be available in Angular 18.1.
We will get inferred type predicates. A function checking against a certain type and returning a boolean based on that is now automatically defined as a type predicate. That means whenever you use that function on a union type, TypeScript will reduce the amount of that union type according to your function.
Other new features are better checks for regular expressions and better type support whenever you access an object literal dynamically.
Business and Rendering Effects
When using effects, we usually want to control the Signals that the effect function tracks. In application development, it would make sense to define those Signals explicitly.
Alex Rickabaugh, Angular framework lead, explained on GitHub that the effect was designed for Rendering Effects, where implicit tracking is necessary. Explicit tracking would be a good fit for Business Effects.
Currently, the effect is not ready to support this in Angular Core.