ryardley / ts-bus

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

Fix types not applying to sub handlers #45

Closed ryardley closed 4 years ago

ryardley commented 4 years ago

This closes https://github.com/ryardley/ts-bus/issues/42

Not sure how to setup a regression test to avoid this happening again in the future? @dmicic any ideas?

codecov[bot] commented 4 years ago

Codecov Report

Merging #45 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #45   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           6      6           
  Lines          87     89    +2     
  Branches       11     11           
=====================================
+ Hits           87     89    +2
Impacted Files Coverage Δ
src/useBusReducer.ts 100% <100%> (ø) :arrow_up:
src/EventBus.ts 100% <100%> (ø) :arrow_up:
src/useBusState.ts 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 272fd00...1481724. Read the comment docs.

dmicic commented 4 years ago

This closes #42

Not sure how to setup a regression test to avoid this happening again in the future? @dmicic any ideas?

@ryardley In languages that I am more familiar with (e.g. C#), I would write in such cases code quality tests that analyse the structure of the object under test (e.g. function, class etc.) with the help of reflection. Now in the TS/JS world I am not sure whether this is achievable, resp. whether the reflection-like functions as for example "getOwnPropertyDescriptor' are sufficient to extract the function signature of all overloads.