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

createScope should return container type by default #178

Closed
moltar opened this issue Apr 12, 2020 · 2 comments · Fixed by #182
Closed

createScope should return container type by default #178

moltar opened this issue Apr 12, 2020 · 2 comments · Fixed by #182

Comments

@moltar
Copy link

moltar commented Apr 12, 2020

createScope<T extends object = any>(): AwilixContainer<Cradle & T>

If you create a scoped container without a generic type, the return type of the new container is any

interface Foo {
  foo: string
}
const container = createContainer<Foo>()

// scoped has AwilixContainer<any> type
const scoped = container.createScope()

I think the type should be:

createScope<T extends object = {}>(): AwilixContainer<Cradle & T>
@jeffijoe
Copy link
Owner

I'm ok with that. Feel free to submit a PR.

@moltar
Copy link
Author

moltar commented Apr 12, 2020

Will do tomorrow.

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 a pull request may close this issue.

2 participants