microsoft / microsoft/tsyringe

Feature request: Disallowing singleton override

Open
#92 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
6k
Forks
184
Avg merge
3m
Merged PRs (30d)
1

Description

There is currently no way to disallow tsyringe from overriding existing registrations for singletons. This would be really useful to prevent erroneously overriding existing registrations.

A good way to handle this is the SimpleInjector approach: https://simpleinjector.readthedocs.io/en/latest/howto.html#override-existing-registrations

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing how tsyringe currently handles registration overrides and compare the requested behavior with the linked SimpleInjector guidance. Define the API and failure behavior for disallowing singleton overrides, then add tests covering existing and non-existing registrations; the work is done when those tests demonstrate that protected registrations cannot be replaced.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.