-
Notifications
You must be signed in to change notification settings - Fork 206
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
Wrong typescript type for $.ap() #547
Comments
Hey @vlinder 👋 . I think the existing types are as intended. Here's the implementation of ap. Can you help me understand why you feel they should be different? |
Thanks for your response! The docs state that you should pass a stream of values. Or rather that you call Line 701 in bfed148
However the typings as I linked in the OP most/type-definitions/most.d.ts Line 75 in bfed148
I wrote a short program to verify which was right, the docs or the types. Typescript playground here import { periodic } from "most";
const add = (a: number, b: number) => a + b;
const value$ = periodic(1000).constant(1).scan(add, 0);
const f$ = periodic(5000)
.constant(1)
.scan(add, 0)
.map((x) => (y: number) => x * y);
f$.ap(value$).forEach(console.log); This code work well, but it does not type check since the I would gladly create a PR with those improved typings if there was a chance for them to be merged and released. But since my last PR that was very simple was never responded to I'm a bit hesitant to put in the effort if it is just going to be ignored. Let me know! :) |
most/type-definitions/most.d.ts
Line 75 in bfed148
Not sure how this can have survived for so long, but this type suggests that you should pass a stream of functions to
f$.ap()
when in fact you should pass a stream of values.The typings below should be the correct ones.
This also works
Should I make a PR?
The text was updated successfully, but these errors were encountered: