Definitelytyped: Winston's defaultLogger property should be renamed to default

Created on 7 Nov 2016  路  2Comments  路  Source: DefinitelyTyped/DefinitelyTyped

  • [x] I tried using the latest winston/winston.d.ts file in this repo and had problems.
  • [x] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • [x] I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • [x] I want to talk about winston/winston.d.ts.

    • The authors of that type definition are cc/ @vvakame @CodeAnimal @MugeSo @horiuchi @spazard1 @jcristovao @nimish @DanielRosenwasser @Stephn-R @CaselIT @Bartvds @AyaMorisawa @awarecan @trainerbill

There is no property defaultLogger for winston. Instead, there is default (https://github.com/winstonjs/winston/blob/master/lib/winston.js#L157)

I believe defaultLogger was chosen because default is a keyword. However, this forces me to use winston['default'] to access the property. Also, trying to access winston.defaultLogger will not yield a defined value.

Bug

All 2 comments

For context, here's a link to the current state of the 2.0 type declarations.

This file have to be rewritten to use an interface to declare Winston's exports, along with a variable and a namespace that has no value side:

declare var winston: Winston;
export = winston;

// Exported types go here.
declare namespace winston {

    // Exported values go here.
    interface Winston {
        transports: Transports;
        Transport: TransportStatic;
        Logger: LoggerStatic;
        Container: ContainerStatic;
        loggers: ContainerInstance;
        default: LoggerInstance;
        // ...
    }

    export interface ExceptionProcessInfo {
        pid: number;
        uid?: number;
        gid?: number;
        cwd: string;
        execPath: string;
        version: string;
        argv: string;
        memoryUsage: NodeJS.MemoryUsage;
    }
}

@westy92 @DanielRosenwasser Should this issue go ahead and be closed since #12551 was merged in?

Was this page helpful?
0 / 5 - 0 ratings