From e9c5e46a60d542a6b03039cbf459127fdfd87fd8 Mon Sep 17 00:00:00 2001 From: iteriani Date: Wed, 26 Mar 2025 14:40:42 -0700 Subject: [PATCH] refactor(core): Check for ngMetadataName instead of instanceof. Wiz doesn't extend InjectionToken. (#60572) In cases such as Wiz, we avoid using the InjectionToken class since it comes from @angular/core. PR Close #60572 --- packages/core/src/di/r3_injector.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/src/di/r3_injector.ts b/packages/core/src/di/r3_injector.ts index 28fab28722a..f311b76aa9c 100644 --- a/packages/core/src/di/r3_injector.ts +++ b/packages/core/src/di/r3_injector.ts @@ -681,7 +681,8 @@ function hasOnDestroy(value: any): value is OnDestroy { function couldBeInjectableType(value: any): value is ProviderToken { return ( - typeof value === 'function' || (typeof value === 'object' && value instanceof InjectionToken) + typeof value === 'function' || + (typeof value === 'object' && value.ngMetadataName === 'InjectionToken') ); }