Giter VIP home page Giter VIP logo

Comments (7)

lechodiman avatar lechodiman commented on May 22, 2024 4

I got this to work by specifying the generic type as winston.Logger

const logger = Container.get<winston.Logger>('logger');

from bulletproof-nodejs.

mattlehrer avatar mattlehrer commented on May 22, 2024 2

I got this to work by adding a LoggerInterface in src/interfaces/LoggerInterface.ts:

interface LoggerInterface {
  debug(message: string, ...args: any[]): void;
  info(message: string, ...args: any[]): void;
  warn(message: string, ...args: any[]): void;
  error(message: string, ...args: any[]): void;
  silly(message: string, ...args: any[]): void;
}

and then adding that type to every definition of the logger container:
const logger: LoggerInterface = Container.get('logger');

I am extremely new to TS so there is probably a better way to do this but it does appear to work.

from bulletproof-nodejs.

santiq avatar santiq commented on May 22, 2024
  • Are you registering the logger within typedi?
  • Are you calling the event subscriber loader before the container's initialization?

from bulletproof-nodejs.

hubochkin avatar hubochkin commented on May 22, 2024

@santiq
Container.set('logger', LoggerInstance)
in dependencyInjector

But it just a copy of this git project. I cant build a project.

Can we fix this together?

from bulletproof-nodejs.

peiris avatar peiris commented on May 22, 2024

@santiq I'm having the same issue here. @hubochkin Were you able to fix this issue?

from bulletproof-nodejs.

hubochkin avatar hubochkin commented on May 22, 2024

@peiris No, I didn't :(

from bulletproof-nodejs.

bjfletcher avatar bjfletcher commented on May 22, 2024

This looks to me to be a duplicate of #27

from bulletproof-nodejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.