pimterry / loglevel

:ledger: Minimal lightweight logging for JavaScript, adding reliable log level methods to wrap any available console.log methods
MIT License
2.62k stars 157 forks source link

loglevel 1.6.2 is in conflict with @types/core-js 2.5.0 #135

Closed aleksandrsivanovs closed 5 years ago

aleksandrsivanovs commented 5 years ago

Hi!

based on the latest release 1.6.2 (adding typescript definitions directly to the package) we are getting this error: node_modules/@types/core-js/index.d.ts(332,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'log' must be of type 'RootLogger', but here has type 'Log'

pimterry commented 5 years ago

Hmm, interesting. It seems we both define a global log, with different types, which of course fails.

Did you have @types/loglevel installed before, and did that used to work? If not, can you downgrade to 1.6.1, and install those types, and see if that works? I made some very small changes as part of inlining the type definitions here, and I'm wondering if that affected this.

In loglevel's case the global declaration could potentially be omitted - it's a UMD module, so it does create a global log variable sometimes, but only if you're using it with no require/define globals available (i.e. no bundlers or module systems). It seems likely that for anybody using TypeScript, they're also using at least some basic infrastructure like that, and it'd be possible to work around if not, so that could be omitted.

pimterry commented 5 years ago

@aleksandrsivanovs I've done some more testing, and I've just pushed some changes that will fix this, and documented the workaround for anybody who really does want global loglevel definitions.

Can you please try npm install pimterry/loglevel, to install the current master directly from github, and check if that solves your problem?

If you're happy that works, I'll put out a 1.6.3 release to fix this up later today.

aleksandrsivanovs commented 5 years ago

Hi!

sorry - missed comments here. verified - fixed now :)

please release 1.6.3 :)

Aleksandrs

pimterry commented 5 years ago

Great, thanks for checking that. 1.6.3 is now released :+1: