Modules and common object names (Event)

Topics: General, Language Specification
Aug 21, 2013 at 3:15 AM
I've been working on a new definitions file for SlickGrid -> and I don't know how to solve the following problem:

The Event interface is already defined by lib.d.ts and is used in places within SlickGrid, however SlickGrid also defines its own 'Event' type under the "Slick.Event" module/namespace. Is it possible to have both types named as "Event"?

The problem I ran into was that the Slick.Event type is being used in the definitions file regardless if it is referenced as "Slick.Event" or "Event" since I guess it takes precedence over the lib.d.ts Event type. Is it possible to reference the lib.d.ts Event somehow.. or what can be done? The only option I can think of is maybe using an exports = { } and have it defined as something internal like Slick.SlickEvent and then export as Slick.Event, but I don't know if this will clash with lib.d.ts Event for the end user (and frankly I haven't wanted to give it a try yet).

OK I just tried typescript declare var LibEvent: typeof Event; but it doesn't recognize it as a type and I can't to typescript delcare var LibEvent: typeof Event = Event; since this is a definitions file. Hmm, any help is appreciated.