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

awilix-koa 1.0.3 doesn't work with awilix 3.0.0-rc.3 - typescript issue #67

Closed
ith opened this issue Nov 28, 2017 · 4 comments
Closed
Labels

Comments

@ith
Copy link

ith commented Nov 28, 2017

I'm getting below error trying to compile code. There are some typings missing or I'm using incompatible versions?

node_modules/awilix-koa/lib/invokers.d.ts(1,10): error TS2305: Module '"node_modules/awilix/lib/awilix"' has no exported member 'Registration'.
node_modules/awilix-koa/lib/invokers.d.ts(1,24): error TS2305: Module '"node_modules/awilix/lib/awilix"' has no exported member 'RegistrationOptions'.

package.json

    "awilix": "^3.0.0-rc.3",
    "awilix-koa": "^1.0.3",
    "typescript": "2.6.1"

Container configuration

import { asFunction, asValue, createContainer } from 'awilix'
import { config } from './config'
import { run } from './some/someController'

export const configureContainer = () => {
    const container = createContainer()

    container.register({
        config: asValue(config),
        someController: asFunction(run),
    })

    return container
}

Using container in koa app

import { scopePerRequest } from 'awilix-koa'

const container = configureContainer()

app
    .use(scopePerRequest(container))

As as side note I had to manually add "@types/glob": "^5.0.33", into dev dependencies - it seems awilix is not pulling it as dependency an TS is whining about it.

Please let me know if you need any additional information.

@jeffijoe
Copy link
Owner

Hi! The Registration typing is definitely an issue and will be fixed when v3 is fully released, but most people disable library type checking which I recommend you do as well. skipLibCheck: true TypeScript option.

The glob types issue will also resolve itself if you skip library checking. I dont want to ship type dependencies.

@ith
Copy link
Author

ith commented Nov 28, 2017

Turned it off and it's working now. Thanks!

If you're planning to fix it with full v3 release than this can stay and wait for release ;)

@jeffijoe
Copy link
Owner

Yes I plan on fixing the Registration typing, but I won't include @types/glob in dependencies 😄

@jeffijoe
Copy link
Owner

Closing as this is now tracked in jeffijoe/awilix-koa#3 😄

@jeffijoe jeffijoe added the bug label Feb 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants