ryardley / ts-bus

A lightweight JavaScript/TypeScript event bus to help manage your application architecture.
MIT License
137 stars 8 forks source link

Types not extending to subscription handler #42

Closed ryardley closed 4 years ago

ryardley commented 4 years ago
import { EventBus, createEventDefinition } from "ts-bus";

export const fetchJobs = createEventDefinition<{ searchText: string }>()(
  "search_jobs"
);

const bus = new EventBus();

bus.subscribe(fetchJobs, event => {
  // event here is typed as BusEvent<any> and not {type:"search_jobs", payload: {searchText:string}}
});

Not sure how this crept in.