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

Correct types for overriden services #4

Merged
merged 3 commits into from
Sep 6, 2024
Merged

Correct types for overriden services #4

merged 3 commits into from
Sep 6, 2024

Conversation

kburov-sc
Copy link
Collaborator

@kburov-sc kburov-sc commented Sep 5, 2024

Fixing an issue where override's type wasn't correctly carried over onto the resulting container, e.g.

const value: number =  Container.providesValue("value", 1).providesValue("value", "two").get("value");

would, incorrectly, compile and cause issues at runtime. With the fix .get("value") return type is correctly resolved to string.

Also fixed provides* implementations that take containers as arguments.

mikalai-snap
mikalai-snap previously approved these changes Sep 5, 2024
Copy link
Collaborator

@mikalai-snap mikalai-snap left a comment

Choose a reason for hiding this comment

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

Good catch! I've tested that change with Camera Kit and everything seems to be good!

Comment on lines 319 to 321
const partialContainer = new PartialContainer({
value: Injectable("value", () => "three"),
});
Copy link
Collaborator

@mikalai-snap mikalai-snap Sep 5, 2024

Choose a reason for hiding this comment

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

nit: this syntax is unusual to me

Suggested change
const partialContainer = new PartialContainer({
value: Injectable("value", () => "three"),
});
const partialContainer = new PartialContainer({}).provides(Injectable("value", () => "three"));

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated, thanks!

@kburov-sc kburov-sc merged commit d85d8f1 into main Sep 6, 2024
1 check passed
@kburov-sc kburov-sc deleted the kb-override-type branch September 6, 2024 00:37
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