aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJack Franklin <[email protected]>2020-05-27 18:39:01 +0100
committerGitHub <[email protected]>2020-05-27 13:39:01 -0400
commiteb2be7caf6c88a41a184ef5ea6e4675f0f372771 (patch)
tree1e17bf59398b1cff97c5e2711b484edd8f9f8c8c /src
parent59cc3d1bc3b85d347baa8883b6206ba88a6071c0 (diff)
Export Mitt types for TS consumers (#101)
* Export Mitt types for TS consumers * Add rudimentary tests for exported TS types * Run tests against the generated output instead of src
Diffstat (limited to 'src')
-rw-r--r--src/index.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/index.ts b/src/index.ts
index f8e7e64..cfb1cf3 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,16 +1,16 @@
-type EventType = string | symbol;
+export type EventType = string | symbol;
// An event handler can take an optional event argument
// and should not return a value
-type Handler = (event?: any) => void;
-type WildcardHandler= (type: EventType, event?: any) => void
+export type Handler = (event?: any) => void;
+export type WildcardHandler= (type: EventType, event?: any) => void
// An array of all currently registered event handlers for a type
-type EventHandlerList = Array<Handler>;
-type WildCardEventHandlerList = Array<WildcardHandler>;
+export type EventHandlerList = Array<Handler>;
+export type WildCardEventHandlerList = Array<WildcardHandler>;
// A map of event types and their corresponding event handlers.
-type EventHandlerMap = Map<EventType, EventHandlerList | WildCardEventHandlerList>;
+export type EventHandlerMap = Map<EventType, EventHandlerList | WildCardEventHandlerList>;
export interface Emitter {
on(type: EventType, handler: Handler): void;