bithavoc / express-winston

express.js middleware for winstonjs
https://www.npmjs.com/package/express-winston
MIT License
795 stars 187 forks source link

Incorrect TypeScript types: metaField, requestField, responseField #256

Closed david-golightly-leapyear closed 3 years ago

david-golightly-leapyear commented 3 years ago

The README specifies that setting metaField, requestField, and responseField to null merges those fields into the root namespace, but the TypeScript types are specified without null as a possible value for those fields, requiring // @ts-ignore comments to set them to null:

export interface BaseErrorLoggerOptions {
    ...
    metaField?: string; // can only be a string or undefined, cannot be null
    requestField?: string;
    responseField?: string;
    ...
}

Since null and undefined are interpreted differently for these fields, the correct types are:

export interface BaseErrorLoggerOptions {
    ...
    metaField?: string | null;
    requestField?: string | null;
    responseField?: string | null;
    ...
}