tsyringe icon indicating copy to clipboard operation
tsyringe copied to clipboard

@scope options don't match the documentation

Open ivandotv opened this issue 4 years ago • 2 comments

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

ivandotv avatar Apr 10 '21 22:04 ivandotv

Is this still awaiting triage? Isn't this a bug? Or is "By Design" supporting only these two scopes?

killerchip avatar Feb 14 '22 13:02 killerchip

How is this still an issue?

semiautomatixfu avatar Aug 19 '22 01:08 semiautomatixfu