-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
getting Property 'error' does not exist on type '{}' #27
Comments
We need to do JSON.parse(Container.get('logger')) to remove error. It is in many files. Any generic way to solve this problem? |
Hi! |
Instead of directly importing this - import { Container } from 'typedi'; we can create a wrapper over this and that wrapper will return us the parsed version of object. What do you say? |
When you get a service from DI container you should define the returned value as Logger interface from winston.
|
What's the update on this? |
Similar to @dzianisreznik's answer:
|
@dzianisreznik and @bjfletcher this approach solves the problem. Though without importing
Now with your solutions, I was wondering if I'm getting the instance from just to tell typescript that the instance we are pulling out from the DI container is of type And does not |
When running npm run build, getting Property 'error' does not exist on type '{}' in src/api/middlewares/attachCurrentUser.ts on Logger. Why?
The text was updated successfully, but these errors were encountered: