Skip to content

JavaScript has no sorted containers. I built one for TypeScript.

6.6 relevance
Score Breakdown
technical depth
7
novelty
7
actionability
8
community
5
strategic
4
personal
6

Scored daily by a customisable AI persona to surface the most relevant engineering leadership news.

New sorted container library for TypeScript, useful but niche and not AI/cloud focused.

Languages dev.to
JavaScript has no sorted containers. I built one for TypeScript.
Summary

A new TypeScript library, sorted-collections, provides SortedList, SortedSet, and SortedMap using a bucket-based design inspired by Python's sortedcontainers, achieving O(log n) insertions and O(√n) positional access with zero dependencies (~2KB gzip). Bulk construction can be up to 3x faster than per-element insertion for SortedMap at one million entries, and custom comparators are fully typed. The package is gated by publint, arethetypeswrong, and size-limit in CI, but for small datasets a plain array with .sort() remains simpler.

Author

Johans Neira

More from Johans Neira →