0

I have a TypeScript package that subclasses EventEmitter from the eventemitter3 JavaScript package. Because EE3 isn't written in TypeScript, I have its module definition installed as an ambient dependency via Typings.

I just spent the past hour reading up on TS inheritance and classes because I tried to consume my package and kept getting errors that on was missing on a subclass of an EventEmitter. Eventually I realized that my consuming project also needed to run typings install --ambient eventemitter3 so that it had the superclass definitions

Is there any way to hide this implementation detail from consuming packages? I.e. either dump the eventemitter3 declarations into my own package's lib/index.d.ts automatically, or somehow install this ambient dependency whenever someone consumes my package?

I don't think this is a duplicate of this question because I think what the author is doing there is working with an NPM package that already defines its own declarations. In my case, I'm building a TypeScript-based NPM package that provides its own declaration, but that pulls in ambient declarations from Typings.

If it helps, the project I'm building is here. New to TypeScript and this is the first time I've soldiered through all the non-error compiler errors, so go easy on my missing/any types. :)

1 Answer 1

0

Is there any way to hide this implementation detail from consuming packages

No. Its the same as node.d.ts. This is stuff that the user needs to get and you need to mention that they need to get.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.