HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
joeycumines
ts-chan
TypeScript2023–2023
joeycumines / ts-chan

ts-chan

Concurrency primitives for TypeScript and JavaScript.

2Distinct people
7Mentions
0Explicit recommenders
110GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Concurrency primitives for TypeScript and JavaScript.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 5:04:57 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by 3-hour interval7 dated mentions

Observed mentions: 2023-11-05 22:50:32 UTC to 2023-11-08 04:08:23 UTC.

0122023-11-05 21:00:00 UTC to 2023-11-06 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 commentsNov 5, 21:002023-11-06 00:00:00 UTC to 2023-11-06 03:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-11-06 03:00:00 UTC to 2023-11-06 06:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2023-11-06 06:00:00 UTC to 2023-11-06 09:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-11-06 09:00:00 UTC to 2023-11-06 12:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2023-11-06 12:00:00 UTC to 2023-11-06 15:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-11-06 15:00:00 UTC to 2023-11-06 18:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-11-06 18:00:00 UTC to 2023-11-06 21:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-11-06 21:00:00 UTC to 2023-11-07 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-11-07 00:00:00 UTC to 2023-11-07 03:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsNov 7, 00:002023-11-07 03:00:00 UTC to 2023-11-07 06:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-11-07 06:00:00 UTC to 2023-11-07 09:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-11-07 09:00:00 UTC to 2023-11-07 12:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-11-07 12:00:00 UTC to 2023-11-07 15:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-11-07 15:00:00 UTC to 2023-11-07 18:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-11-07 18:00:00 UTC to 2023-11-07 21:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-11-07 21:00:00 UTC to 2023-11-08 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments2023-11-08 00:00:00 UTC to 2023-11-08 03:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-11-08 03:00:00 UTC to 2023-11-08 06:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsNov 8, 03:00

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Nov 5, 21:002023-11-05 21:00:00 UTC2023-11-06 00:00:00 UTC110
Nov 6, 00:002023-11-06 00:00:00 UTC2023-11-06 03:00:00 UTC000
Nov 6, 03:002023-11-06 03:00:00 UTC2023-11-06 06:00:00 UTC202
Nov 6, 06:002023-11-06 06:00:00 UTC2023-11-06 09:00:00 UTC000
Nov 6, 09:002023-11-06 09:00:00 UTC2023-11-06 12:00:00 UTC101
Nov 6, 12:002023-11-06 12:00:00 UTC2023-11-06 15:00:00 UTC000
Nov 6, 15:002023-11-06 15:00:00 UTC2023-11-06 18:00:00 UTC000
Nov 6, 18:002023-11-06 18:00:00 UTC2023-11-06 21:00:00 UTC000
Nov 6, 21:002023-11-06 21:00:00 UTC2023-11-07 00:00:00 UTC000
Nov 7, 00:002023-11-07 00:00:00 UTC2023-11-07 03:00:00 UTC000
Nov 7, 03:002023-11-07 03:00:00 UTC2023-11-07 06:00:00 UTC000
Nov 7, 06:002023-11-07 06:00:00 UTC2023-11-07 09:00:00 UTC000
Nov 7, 09:002023-11-07 09:00:00 UTC2023-11-07 12:00:00 UTC000
Nov 7, 12:002023-11-07 12:00:00 UTC2023-11-07 15:00:00 UTC000
Nov 7, 15:002023-11-07 15:00:00 UTC2023-11-07 18:00:00 UTC000
Nov 7, 18:002023-11-07 18:00:00 UTC2023-11-07 21:00:00 UTC000
Nov 7, 21:002023-11-07 21:00:00 UTC2023-11-08 00:00:00 UTC211
Nov 8, 00:002023-11-08 00:00:00 UTC2023-11-08 03:00:00 UTC000
Nov 8, 03:002023-11-08 03:00:00 UTC2023-11-08 06:00:00 UTC101

What Hacker News says

7 sources
Generators have lots of really nice uses, yep. I'm not sure what specifically you were imagining, but I've added an example of how "vanilla JS" can achieve fan-in, using an AsyncGenerator: https://github.com/joeycumines/ts-chan/blob/main/docs/patter... It uses one of the patterns suggested in a comment chain above, which I think is pretty neat, and wasn't one that readily occurred to me: https://news.ycombinator.com/item?id=38163562 I'm not making a case for using ts-chan for any situation where a simple generator-based solution suffices. I wouldn't call the example solution (in my first link) simple, but it's something I'd personally be ok with maintaining. Like, I'd approve a PR containing something similar without significant qualms, _if_ there was a significant enough motivator, and it was sufficiently unit tested. I might suggest `ts
Read the rest
-chan` as an alternative, to make it easier to maintain, but wouldn't be particularly concerned either way. That's all very subjective, though :)
In Show HN: Ts-Chan – Go-Like Concurrency Primitives for TypeScript/JavaScript
Hey HN, Based on feedback on my last post: https://news.ycombinator.com/item?id=38156519 I've been working on better documentation and examples, aimed at JavaScript developers without significant knowledge of concurrency-related patterns. The first pattern I've covered is "fan-in". Aside from a side-by-side comparison, in the pattern doc linked in the question, I also implemented an example of the pattern, a "log aggregator", which multiplexes (TCP) log streams, formatting and writing out lines to a file. Details in the example readme: https://github.com/joeycumines/ts-chan/blob/main/examples/pa... I'd appreciate it if you could let me know what you think, and if this is a step in a helpful direction. Thanks :)
In Ask HN: Fan-in pattern in JavaScript, ts-chan docs, feedback requested
Concurrency is just the ability to handle multiple tasks at the same time, to use my quickly googled definition. JavaScript already supports concurrency, e.g. handling more than one HTTP request concurrently, despite the runtime being single-threaded in nature. Also provided by JavaScript is the ability to fork and join with other asynchronous tasks, e.g. using `Promise.all` to wait for multiple HTTP requests to complete. The purpose of `ts-chan` is to make it easier to coordinate concurrent operations, via communication, which definitely isn't something JavaScript makes easy. So part of this is addressing usability issues, and providing necessary boilerplate. I've modelled most of that after Go's channels. Another is providing a mitigation for a common gotcha (well, it's gotten me), when attempting to implement behavior that involves mul
Read the rest
tiple independent asynchronous operations, communicating with one another. Specifically, JS has a "microtask queue", an optimisation I believe was created to power async/await. Details / links to MDN here: https://github.com/joeycumines/ts-chan#the-microtask-queue-a...
In Show HN: Ts-Chan – Go-Like Concurrency Primitives for TypeScript/JavaScript
I somewhat disagree with this take, as I felt the intro and "The microtask queue: a footgun" [1] section in the README does an adequate job of laying out the 'why' and the problems with JS's concurrency model. However, it does presume some understanding of Go's channels, so a more explicit example contrasting ts-chan with native JS concurrency could better clarify its benefits for those less familiar. Granted, there is an /example directory, but the benchmarking complexity muddles the readability. Regardless, upon a quick run-through, it looks to be an A-grade library that seems promising for practical use, plus well-referenced, composed, and quite thorough. [1] https://github.com/joeycumines/ts-chan#the-microtask-queue-a...
In Show HN: Ts-Chan – Go-Like Concurrency Primitives for TypeScript/JavaScript
The concurrency comes from providing mechanisms to communicate between independent, asynchronous chains of operations. Here is an example, that I based on an example from within the Go spec: https://github.com/joeycumines/ts-chan/blob/main/examples/co... Here is the same example in Go: https://github.com/joeycumines/ts-chan/blob/main/examples/co... The JS example is, obviously, much slower, and is fairly contrived - I wouldn't expect anyone to actually want to do that, specifically. The JS one is more complicated primarily because I used it in a benchmark, so needed a mechanism to stop the concurrent, asynchronous chains of operations, once it reached the target number of primes. I hope that explains it for you.
In Show HN: Ts-Chan – Go-Like Concurrency Primitives for TypeScript/JavaScript

Show HN: Ts-Chan – Go-Like Concurrency Primitives for TypeScript/JavaScript

Hey HN, I’m sharing ts-chan, an NPM package providing Go-like concurrency primitives, including channels and select statements, for TypeScript and JavaScript, supporting Node.js, Deno, Bun, and browsers. This is something I've built to make implementing Go-style "control loops" feasible in JavaScript, but there are many possible applications. Highlights: - Features a FIFO processing Chan class and versatile Select class for concurrency control. - Supports buffered channel and channel close semantics very close to Go's. - TypeScript-first implementation. - Defines a simple "channel protocol" inspired by JavaScript's iteration protocols, that's used by `Select`, and implemented by `Chan`. - Makes an effort to mitigate cycles caused by the behavior of JavaScript's microtask queue. - Ongoing project with active iteration for a production-read
Read the rest
y module (pre-v1, so the API isn't guaranteed to be stable, but the implementation itself is). NPM: ts-chan GitHub: github.com/joeycumines/ts-chan Thanks!
60 points · Open discussion

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.