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

Refactored some types to avoid "as" casting #15

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

mikalai-snap
Copy link
Collaborator

@mikalai-snap mikalai-snap commented Nov 28, 2024

The new "as" casting bothered me when we started to explicitly specify return types of provide*/append* methods and I decided to dig into why providesService doesn't return a type that we expect. This PR is the result of this. No broken unit tests, so the expectations remain the same.

I want to do similar cleanup to PartialContainer, but that might be don in another PR.

src/Container.ts Outdated
providesClass = <
Token extends TokenType,
Tokens extends readonly ValidTokens<Services>[],
Class extends {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, does it mean we can remove InjectableClass and ClassInjectable now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, removed that.

@kburov-sc
Copy link
Collaborator

Don't forget to bump version up

@mikalai-snap mikalai-snap marked this pull request as ready for review December 2, 2024 19:08
@mikalai-snap mikalai-snap force-pushed the ms/fix-provides-class branch from b1c4404 to 6ac71b0 Compare December 2, 2024 19:20
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.

2 participants