I encountered this error within an Angular Material component when using Angular version 18, while Angular Material was still on version 17.
Upgrading Angular Material to match the Angular version resolved the issue.