-
Notifications
You must be signed in to change notification settings - Fork 134
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
Add generic parameter to AwilixContainer interface #169
Conversation
src/container.ts
Outdated
@@ -42,7 +42,7 @@ export interface AwilixContainer { | |||
/** | |||
* Creates a scoped container with this one as the parent. | |||
*/ | |||
createScope(): AwilixContainer | |||
createScope<T extends object = any>(): AwilixContainer<T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be
createScope<T extends object = any>(): AwilixContainer<T> | |
createScope<T extends object = any>(): AwilixContainer<Cradle & T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, my bad
src/container.ts
Outdated
} | ||
export type NameAndRegistrationPair<T> = Partial< | ||
{ | ||
[U in keyof T]: Resolver<T[U]> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove Partial
and use
[U in keyof T]: Resolver<T[U]> | |
[U in keyof T]?: Resolver<T[U]> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/load-modules.ts
Outdated
@@ -43,9 +43,9 @@ export type NameFormatter = ( | |||
/** | |||
* Dependencies for `loadModules` | |||
*/ | |||
export interface LoadModulesDeps { | |||
export interface LoadModulesDeps<T extends object> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loadModules
is dynamic already, I don't think we need to worry about it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need to worry in this file altogether? or just this interface and its uses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the entire file. Loading modules from the file system can never provide any static type analysis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted this file
One last favor before we release, could you check out |
Just did, and everything passed. Just to be sure, what I did to test it was change the |
Sounds good, last step is squashing your commits into 1 commit. If you don't want to, I can do a Squash and Merge on GH but it's not as nice. 😄 |
Remove unnecessary conversions CR fix Revert
Done :) |
Fantastic, thank you! |
No description provided.