Closed spb-web closed 4 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.
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.
The same problem reported as an issue https://github.com/namshi/winston-graylog2/issues/82
This PR is not needed, just import properly:
Sample was taken from example given by @schfkt:
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');
@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
Closing this in favor of https://github.com/namshi/winston-graylog2/pull/84
Type 'typeof TransportStream' is not a constructor function type.