Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Typescript - info() is not a function #2348

Open
1tmb opened this issue Sep 10, 2023 · 1 comment 路 May be fixed by #2351
Open

[Bug]: Typescript - info() is not a function #2348

1tmb opened this issue Sep 10, 2023 · 1 comment 路 May be fixed by #2351

Comments

@1tmb
Copy link

1tmb commented Sep 10, 2023

馃攷 Search Terms

typescript,info,logger

The problem

README.md is clear that the following syntax is legal:

logger.info('Hello world')

However I cannot get this to work with Typescript.

Versions:

Winston version: 3.10.0
Node version: v20.5.1

Example:

Using "esModuleInterop": true in tsconfig.json to allow the use of Winston using import syntax:

import { Logger, transports, format } from 'winston'
const logger = new Logger({
  level: 'debug',
  transports: [new transports.Console()],
  format: format.combine(format.splat(), format.colorize({ all: true }), format.simple())
})

logger.info('Hello world')

export default logger

Expected:

Console output of: Hello world

Actual:

logger_1.default.info is not a function

What version of Winston presents the issue?

3.10.0

What version of Node are you using?

20.5.1

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

No response

Minimum Working Example

Using "esModuleInterop": true in tsconfig.json to allow the use of Winston using import syntax:

import { Logger, transports, format } from 'winston'
const logger = new Logger({
  level: 'debug',
  transports: [new transports.Console()],
  format: format.combine(format.splat(), format.colorize({ all: true }), format.simple())
})

logger.info('Hello world')

export default logger

Additional information

No response

@1tmb
Copy link
Author

1tmb commented Sep 10, 2023

Possible duplicate of #2280

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant