namshi / winston-graylog2

Graylog2 transport for winston, a nodejs logging module
MIT License
126 stars 98 forks source link

fixed index.d.ts #76

Closed spb-web closed 4 years ago

spb-web commented 5 years ago

Type 'typeof TransportStream' is not a constructor function type.

schfkt commented 5 years ago

@spb-web do you have esModuleInterop compiler option set to true in your tsconfig?

The thing is, you commit fixes the typings for the case when that option is set to true, but breaks it for the cases when that option is disabled. See yourself with this sample code: https://github.com/schfkt/graylog-test

So we need to find a way to make it work for the both cases when esModuleInterop is enabled and disabled.

julioocamargoo commented 5 years ago

I'm facing the same problem. Maybe a major version will be needed. esModuleInterop is a default config on TS 3.0 and seems like the community is heading this way.

glensc commented 4 years ago

The same problem reported as an issue https://github.com/namshi/winston-graylog2/issues/82

glensc commented 4 years ago

This PR is not needed, just import properly:

Sample was taken from example given by @schfkt:

scalder27 commented 4 years ago

I think this PR is needed - it's not okay when a library tells you what ts settings you should use. But as @schfkt said - we need a solution that equally works with esModuleInterop's both values.

How about this one?

import TransportStream = require('winston-transport');
schfkt commented 4 years ago

@scalder27 Thanks for the suggestion. It works for both cases: when esModuleInterop is enabled or disabled. Here's the PR with the fix: https://github.com/namshi/winston-graylog2/pull/84

schfkt commented 4 years ago

Closing this in favor of https://github.com/namshi/winston-graylog2/pull/84