-
-
Notifications
You must be signed in to change notification settings - Fork 421
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
Shouldn't ResponseStream extend Stream? #547
Comments
Actually, perhaps I should use But the whole notion of exported interface is yet not clear to me. How do I know which ones are public. I mean, I do import them just like JavaScript values. Is a change to an exported interface considered breaking? Are these exported interfaces usually documented? I just look at the source of Cycle.js, snabbdom and xstream and import from there. I try to be reasonable about what I use but it seems pretty much dictated by TypeScript. If I desire type checking then I must use those types. |
Yeah, I believe it should be |
Maybe |
@whitecolor I don't get it. Why not? That's pretty much what it is, isn't it? Did you see my PR? You're welcome to review it. |
I don't know what is was meant by @staltz under |
I think the only problem here is the naming, which can be confusing. But we actually need the separate interface, and we cannot do |
There isn't the field
The exported ones are public.
They are TypeScript types, not JavaScript values (e.g. they never show up in the compiled JS)
Usually it is. |
Well, then. The naming. It shouldn't be called So, what it is, seems to me like what I did in #548. Which is |
I know the naming could be better, but in what cases would you require importing select(category?: string): Stream<MemoryStream<Response> & {request: RequestOptions}>; Because HTTPSource.select is pretty much the only public API that has this. But I don't exclude the idea of making |
The bottom line for me is to be able to import the type that is emitted by the stream that For the purpose of const fooResponse$$: Stream<[WhatHereNow]> = HTTP.select('foo') |
Usually I write just const fooResponse$$ = HTTP.select('foo') Because the type of type Res$$ = Stream<MemoryStream<Response> & {request: RequestOptions}>;
const fooResponse$$: Res$$ = HTTP.select('foo') Notice that even if we have RequestBearing, it would be quite verbose: const fooResponse$$: Stream<MemoryStream<Response> & RequestBearing> = HTTP.select('foo') or even type Res$$ = Stream<MemoryStream<Response> & RequestBearing>;
const fooResponse$$: Res$$ = HTTP.select('foo') That's why I recommend const fooResponse$$ = HTTP.select('foo') |
While my journey with TypeScript is yet short, I find it useful to declare types that I assume would otherwise be inferred. Declaration > inference. Because inferred type mighty be not what one thinks and also for documentation that could not be wrong (unlike comments). That's why I gave it a name and made it exported. |
Response is something that comes for a given request. |
@mightyiam I don't think that you should be belittling your understanding of TS. Not at all. Typing simply highlights an existing cycle problem here, which is trying to turn consumer's pull semantic into consumer's push. Erik talks overall about this in a very nice talk (thanks to @staltz for link, talk in enlightening). |
This question was discussed many times, about is there is a need in a pull in HTTP like drivers, it seems like it breaks cyclic semantic and basically approach. When you are in starbucks and you order coffee on one side of the counter, you expect to get your cup on the other side of the counter with a named label attached when coffee is ready, is it a pull, are you pulling your cup of coffee or just waiting it pushed? |
|
@whitecolor |
What is the problem, add pull to HTTP driver, or what you use a see how it works for you. I use my own drivers set, and HTTP like drivers are based on the same driver called |
@whitecolor In fact, I don't want to write drivers. I want to write nicely flowing circuits that may have some pull-ing nodes. In a visual tool, clicking on pull node can open a circuit responsible for producing result to a pull. Such producer circuit will be like other cycle circuits, and it will be visualizable in all tools. |
Wow, @whitecolor , I see you actually created repo that allows you to have async pulls. Isn't this is one more point that pull should be added to cycle? |
It is his own time and he probably knows what he's doing, and you is not restricted in any way to use cycle framework as you like to Just don't depend on this so eagerly, no need to fear. Cycle is really simple, you even may use you own I had my comments in #581 |
Here is
ResponseStream
.Since it is a stream, perhaps it should extend xstream's
Stream
?I'm trying to provide a
ResponseStream
to xstream'scombine
and I'm getting this:The text was updated successfully, but these errors were encountered: