What is the purpose of any type cast function?

You can disable binding expression type checking using $any() type cast function(by surrounding the expression). In the following example, the error Property contacts does not exist is suppressed by casting user to the any type.

template: '{{ $any(user).contacts.email }}';

The $any() cast function also works with this to allow access to undeclared members of the component.

template: '{{ $any(this).contacts.email }}';

February 10, 2022
160