Closed MadaraUchiha closed 6 years ago
I personally don't use TypeScript, but I'd like to get this resolved (as I thought https://github.com/scottcorgan/tiny-emitter/pull/22 fixed it). I'm open to a PR to fix it, and that'd be awesome!
Is there any reason why this fix was not published to npm?
@danguilherme it is now! Sorry for that.
Awesome, thanks! I think you might want to create a tag for that? 😄
Done
Code:
Expected: TinyEmitter available and no compilation errors thrown
Actual: TypeScript complains about
module 'tiny-emitter' resolves to a non-module entity and cannot be imported using this construct
Classes can't be exported with the
export = Something
syntax and be imported with theimport * as
syntax.They must be imported with
import TinyEmitter = require('tiny-emitter')
, which will also fail compilation if you're not targetingcommonjs
modules.While the correct solution is likely to move to ES2015 modules in the package's source (and have the transpiler deal with it), I propose we add either a
exports.default = TinyEmitter
orexports.TinyEmitter = TinyEmitter
and change the .d.ts file, so that we may import TinyEmitter in the standard way.