What are type safe TestBed API changes in Angular9?

Angular 9 provides type safe changes in TestBed API changes by replacing the old get function with the new inject method. Because TestBed.get method is not type-safe. The usage would be as below,

TestBed.get(ChangeDetectorRef); // returns any. It is deprecated now.
TestBed.inject(ChangeDetectorRef); // returns ChangeDetectorRef

Author of content
Edit this page

Made by Michael Sakhniuk

Twitter