Function: getProviderScope()
getProviderScope(
provider
):Scope
Determines the lifetime scope (singleton or transient) for a given provider or class.
- If the provider is a class constructor, reads its metadata.
- If the provider is an object with
useClass
, reads metadata from that class. - If the provider is an object with
useValue
, infers the class from the value’s constructor.
Falls back to Scope.SINGLETON
when no metadata is found.
Parameters
provider
Provider
<unknown
>
Either a class constructor or a Provider object.
Returns
The Scope of the provider: SINGLETON
or TRANSIENT
.