tsyringe
tsyringe copied to clipboard
@scope options don't match the documentation
Describe the bug
Documentation for @scope says that there are four possible options for lifecycle however, TS gives us only two.
// scoped.d.ts
export default function scoped<T>(lifecycle: Lifecycle.ContainerScoped | Lifecycle.ResolutionScoped, token?: InjectionToken<T>): (target: constructor<T>) => void;
Expected behavior
I expect all four versions to be available. Other options are very convenient. For example, I have a hybrid app, and on the server, I need a new instance every time, but in the browser, I need a singleton.
@scoped(type of window === 'undefined' ? Lifecycle.Transient : Lifecycle.Singleton)
Version:
4.5.0
Is this still awaiting triage? Isn't this a bug? Or is "By Design" supporting only these two scopes?
How is this still an issue?