Skip to content

Commit

Permalink
Remove .Typed subclass from the actual JS since types are available o…
Browse files Browse the repository at this point in the history
…n the main Emittery class now
  • Loading branch information
airhorns committed Dec 28, 2020
1 parent e40fc77 commit 8d03436
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
7 changes: 3 additions & 4 deletions examples/clocktyped.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ interface TickData {
type EventDataMap = {
tick: TickData,
error: Error
start: undefined,
stop: undefined,
};

// List of event which do not required data
type EmptyEvents = 'start' | 'stop';

class Clock extends Emittery.Typed<EventDataMap, EmptyEvents> {
class Clock extends Emittery<EventDataMap> {
private startedAt = 0;
private timer: NodeJS.Timer | null = null;

Expand Down
7 changes: 0 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,6 @@ class Emittery {

const allEmitteryMethods = Object.getOwnPropertyNames(Emittery.prototype).filter(v => v !== 'constructor');

// Subclass used to encourage TS users to type their events.
Emittery.Typed = class extends Emittery {};
Object.defineProperty(Emittery.Typed, 'Typed', {
enumerable: false,
value: undefined
});

Object.defineProperty(Emittery, 'listenerAdded', {
value: listenerAdded,
writable: false,
Expand Down

0 comments on commit 8d03436

Please sign in to comment.