0no-co / wonka

🎩 A tiny but capable push & pull stream library for TypeScript and Flow
MIT License
709 stars 29 forks source link

Are the source docs up-to-date? #45

Closed hanrelan closed 4 years ago

hanrelan commented 4 years ago

Using the docs for makeSubject I did:

let subject = Wonka.makeSubject();
let (source, next, complete) = subject;

and get the error:

This has type:
    Wonka_types.subjectT('a)
  But somewhere wanted:
    ('b, 'c, 'd)

Similarly the example for make doesn't seem to compile (the error is too inscrutable for me to figure out why, but seems to be a type issue)

kitten commented 4 years ago

I think that’s indeed a mistake in the docs. If you cross-reference the type of a subject in the signature you’ll see that it’s a record and not a tuple: https://github.com/kitten/wonka/blob/f26cc6c1cbcbf4f3240a121575492c624f1e1980/src/wonka_types.re#L50

Looks like I’ll need to add some validation / type checking to the markdown docs 😅