HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
MathisBullinger
froebel
TypeScript2022–2022
MathisBullinger / froebel

froebel

A strictly typed utility library.

2Distinct people
6Mentions
0Explicit recommenders
1.1KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A strictly typed utility library.

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, 3:56:07 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 week6 dated mentions

Observed mentions: 2022-05-26 20:31:30 UTC to 2022-08-08 17:16:57 UTC. Weeks start Monday, UTC.

01232022-05-23 00:00:00 UTC to 2022-05-30 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 commentsMay 232022-05-30 00:00:00 UTC to 2022-06-06 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-06-06 00:00:00 UTC to 2022-06-13 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-06-13 00:00:00 UTC to 2022-06-20 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-06-20 00:00:00 UTC to 2022-06-27 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-06-27 00:00:00 UTC to 2022-07-04 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsJun 272022-07-04 00:00:00 UTC to 2022-07-11 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-07-11 00:00:00 UTC to 2022-07-18 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-07-18 00:00:00 UTC to 2022-07-25 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-07-25 00:00:00 UTC to 2022-08-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-08-01 00:00:00 UTC to 2022-08-08 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 comments2022-08-08 00:00:00 UTC to 2022-08-15 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 commentsAug 8

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
May 232022-05-23 00:00:00 UTC2022-05-30 00:00:00 UTC110
May 302022-05-30 00:00:00 UTC2022-06-06 00:00:00 UTC000
Jun 62022-06-06 00:00:00 UTC2022-06-13 00:00:00 UTC000
Jun 132022-06-13 00:00:00 UTC2022-06-20 00:00:00 UTC000
Jun 202022-06-20 00:00:00 UTC2022-06-27 00:00:00 UTC000
Jun 272022-06-27 00:00:00 UTC2022-07-04 00:00:00 UTC000
Jul 42022-07-04 00:00:00 UTC2022-07-11 00:00:00 UTC000
Jul 112022-07-11 00:00:00 UTC2022-07-18 00:00:00 UTC000
Jul 182022-07-18 00:00:00 UTC2022-07-25 00:00:00 UTC000
Jul 252022-07-25 00:00:00 UTC2022-08-01 00:00:00 UTC000
Aug 12022-08-01 00:00:00 UTC2022-08-08 00:00:00 UTC312
Aug 82022-08-08 00:00:00 UTC2022-08-15 00:00:00 UTC202

What Hacker News says

6 sources
This is quite elegant! Direct link to the source of OP's pipe function and recursive type definitions: https://github.com/MathisBullinger/froebel/blob/main/pipe.ts... On a related note, I've been frustrated by the slow progress on https://github.com/tc39/proposal-pipeline-operator - specifically the thread in https://github.com/tc39/proposal-pipeline-operator/issues/91 which has 668 comments over 4+ years and shows no meaningful sign of consensus. The TC39 group is (justifiably) very concerned about backwards and future compatibility, and Typescript has a policy of not introducing syntax that is in scope for Javascript itself until the syntax has formally reached a stable state (see: https://github.com/Microsoft/TypeScript/issues/2103#issuecom...) - so we're far from having a pure operator for this. But `pipe((n: number) => n.toString(),
Read the rest
(a: string) => a+' ')(3)` is as clean as I've ever seen it get. And to use it in an ad-hoc way for left-to-right readability (and for code that will be maintained by those who think curry is just a tasty dish), it's trivial to implement an applyPipe on top: applyPipe('foo', strip, title, (s: string) => `${s}: bar`) OP - it would be great to have that, or something named slightly better, out of the box!
In A generically typed pipe function in TypeScript
When programming in a functional style, quite of often I find myself wanting to rewrite nested function calls as a chain. Hopefully at some point the proposed pipe operator will make it into JavaScript and TypeScript but for now defining a pipe function will have to do. The function should allow rewriting something like double(square(half(2))) as pipe(half, square, double)(2) For a while now I've struggled to implement the type definition for that function, so that every passed-in function can only accept the return type of the previous function as its parameter and the resulting function will take the arguments of the first function as its parameters and return the type of the last function. The main problem with this is that trying to define a type for pipe's arguments up-front would require typing them as an infinitely-recursive
Read the rest
type that TypeScript cannot handle. A common workaround for this is to define pipe's type separately for every number of arguments it can take. This is for example how RXJS defines its pipe function: https://github.com/ReactiveX/rxjs/blob/f174d38554d404f21f98a... Other common solutions are to make concessions like requiring all functions to have the same return type or letting pipe only take one function at a time and returning an object with methods to add another function and invoke the chain. None of these solutions are satisfying in my opinion. I think I've finally found an implementation that fulfills all these criteria. The argument and return types of passed in functions are correctly enforced (no matter the number of passed-in functions) and the pipe function returns a function that accepts the arguments of the first function, invokes all functions in turn with the result of the last, and correctly returns the type of the last function of the chain. Including asynchronous functions in the chain works to: if a function returns a promise that promise is resolved before being passed into the next function and the function returned from pipe will return a promise as its type. There is one disadvantage to the implementation that I'm aware of: When passing in anonymous functions, the types of their arguments can not be inferred if they aren't annotated. That means that pipe(() => 10, n => n.toString()) would return the type () => any but I think that's an acceptable tradeoff because when annotated pipe(() => 10, (n: number) => n.toString()) it will return the correct type () => string Thought the implementation might be worth sharing here in case it's useful to someone else and because it's an interesting problem to solve in TypeScript's type system. If you have any suggestions on how to improve the function's typing or know of any better implementations, I'd appreciate it if you would let me know! Edit: I meant to link to the pipe part of the readme, but I see the link is just to the repo, that's unfortunate. Here is the relevant section of the readme: https://github.com/MathisBullinger/froebel#pipe and here the implementation: https://github.com/MathisBullinger/froebel/blob/main/pipe.ts...
In A generically typed pipe function in TypeScript

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.