Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect context type in handlers #49

Open
2 tasks done
Raiondesu opened this issue Sep 16, 2020 · 0 comments
Open
2 tasks done

Incorrect context type in handlers #49

Raiondesu opened this issue Sep 16, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@Raiondesu
Copy link
Owner

Describe the bug
The type of the event context (TEventContext) is not inferred correctly in event handlers passed to subscribe function.


To Reproduce

import { eventMap, on } from 'eventhoven';

const map = eventMap({
  event(_): 42 { return 42; }
});

on(map)('event')(ctx => {
  ctx.event; // string | number | symbol
  ctx.unsubscribe // TUnsubscribe
});

Expected behavior

import { eventMap, on } from 'eventhoven';

const map = eventMap({
  event(_): 42 { return 42; }
});

on(map)('event')(ctx => {
  ctx.event; // 'event'
  ctx.unsubscribe // TUnsubscribe<'event'>
});

Environment (please complete the following information):

  • OS: Windows
  • Platform:
    • Browser - any
    • Node 12+
  • eventhoven version: v1.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant