Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental support for Identifier Presence Scopes #95

Draft
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

freshgum-bubbles
Copy link
Owner

Currently, Container.has(A) provides no guarantees that Container.get(A)
will not throw. There is no way to check this, aside from checking internal maps
such as metadataMap and multiServiceIds.

This presents an interesting problem: as Container.get(A) may throw, even if
you've checked for its presence, what do you do?

  1. You could wrap each Container.get(A) call in a try { } catch { }... no.
  2. You could hook into container internals, as described above.
  3. Nag the maintainer to implement something sane like this.

Number 3 is what we're going for.

Related Changes

@Service() error message patch

XXX

@changeset-bot
Copy link

changeset-bot bot commented Sep 17, 2023

🦋 Changeset detected

Latest commit: dfbd486

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@freshgum/typedi Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

It's currently not possible to check whether an
identifier is part of a group, or whether it's a
singular item.

This means that, even if Container.has(A) = true,
there is still a possibility that Container.get(A)
will throw.

This makes the API slightly confusing to deal with,
as you have to know which keys form parts of a group,
and which keys don't *before* using the API.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant