Dev Tools · 1h ago
TypeScript gets sorted collections with new open-source library
JavaScript lacks built-in sorted data structures, forcing developers to manually sort arrays. A new TypeScript library, sorted-collections, provides SortedList, SortedSet, and SortedMap with O(log n) insertions and O(√n) positional access. The package has zero dependencies, is ~2KB gzipped, and supports ESM and CJS.
Meridian48 take
A practical solution for a long-standing gap in the JS ecosystem, though its adoption depends on whether developers find the sqrt-decomposition approach intuitive.
Read the full reporting
JavaScript has no sorted containers. I built one for TypeScript. →
DEV Community
typescriptopen-source