winstonjs/logform

[Bug]:

pravin-deore opened this issue · 3 comments

The problem

With latest changes in 2.5.* , following change is added in index.d.ts, which is causing issue "TS1023: An index signature parameter type must be either 'string' or 'number'"

Typescript : 4.3.5
Node : 14

export interface TransformableInfo {
level: string;
message: any;
[LEVEL]?: string;
[MESSAGE]?: any;
[SPLAT]?: any;
[key: string | symbol]: any;
}

What version of Logform presents the issue?

v2.5.0 and v2.5.1

What version of Node are you using?

v14.17.3

If this worked in a previous version of Logform, which was it?

v2.4.2

Minimum Working Example

import {
  createLogger,
  format,
  transports,
  Logger as WinstonLogger,
} from 'winston';

const logger = createLogger({
  level: "error",
  format: format.combine(format.timestamp(), format.json()),
  transports: [new transports.Console({ handleExceptions: false })],
  exitOnError: false,
});

logger.log('debug', "127.0.0.1 - there's no place like home");

package.json

{
"name": "logform-issue",
"version": "1.0.0",
"description": "",
"main": "index.ts",
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"build": "tsc -p tsconfig.json"
},
"author": "",
"license": "ISC",
"dependencies": {
"@types/node": "^18.13.0",
"winston": "^3.8.2",
"typescript": "4.3.5"
}
}

Additional information

No response

🔎 Search Terms

typescript

DABH commented

Are you able to try with TS 4.4+? As reported in some other issues recently, logform 2.5+ (unintentionally) now depends on TS 4.4+, so if your project is stuck with TS 4.3, we recommend pinning logform as a dependency to 2.4.2.

Yes, after changing typescript version to 4.4+ there is no issue.

wbt commented

Duplicate of #244 if folks coming later have further discussions, though only evident if you read this far in that chain.