Skip to content

Commit

Permalink
Merge pull request #36 from mediamonks/export-types
Browse files Browse the repository at this point in the history
Export types from module
  • Loading branch information
flut1 committed Jun 3, 2019
2 parents 3d85146 + 898b480 commit 2d5826f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "seng-event",
"version": "2.0.0",
"version": "2.0.1",
"description": "Provides Classes and utilities for dispatching and listening to events.",
"main": "./index.js",
"types": "./index.d.ts",
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Expand Up @@ -6,6 +6,7 @@
*/
import { default as _export } from './lib/EventDispatcher';

export * from './lib/types';
export { default as createEventClass } from './lib/createEventClass';
export { default as createIsomorphicEventClass } from './lib/createIsomorphicEventClass';
export { default as EventPhase } from './lib/EventPhase';
Expand Down
14 changes: 1 addition & 13 deletions src/lib/createEventClass.ts
Expand Up @@ -2,19 +2,7 @@
* @module seng-event
*/
import BaseEvent from './BaseEvent';

/**
* @ignore
*/
type TypeMap<TType extends string> = { [P in TType]: P };

/**
* @ignore
*/
interface EventTypeClass<TData, TType extends string> {
types: TypeMap<TType>;
new (type: TType, data: TData): BaseEvent<TData, TType>;
}
import { EventTypeClass, TypeMap } from './types';

/**
* Utility function to generate a class that extends [[AbstractEvent]] and optionally has
Expand Down
6 changes: 1 addition & 5 deletions src/lib/createIsomorphicEventClass.ts
Expand Up @@ -3,11 +3,7 @@
*/
import { DataForIsomorphicEvent } from './EventTypings';
import IsomorphicBaseEvent, { EventOptions, EventOptionsMap } from './IsomorphicBaseEvent';

/**
* @ignore
*/
type TypeMap<TType extends string> = { [P in TType]: P };
import { TypeMap } from './types';

/**
* Advanced variant of the [[createEventClass]] util. Creates an _isomorphic_ event class.
Expand Down
14 changes: 14 additions & 0 deletions src/lib/types.ts
@@ -0,0 +1,14 @@
import BaseEvent from './BaseEvent';

/**
* @ignore
*/
export type TypeMap<TType extends string> = { [P in TType]: P };

/**
* @ignore
*/
export interface EventTypeClass<TData, TType extends string> {
types: TypeMap<TType>;
new (type: TType, data: TData): BaseEvent<TData, TType>;
}

0 comments on commit 2d5826f

Please sign in to comment.