Releases: true-myth/true-myth
Release 9.3.1
Identical to v9.3.0; npm was lagging and appeared not to have been published correctly… and then eventually showed up. 🙃
v9.3.0
New features and fixes for True Myth—safe and idiomatic TypeScript types to handle null, error, and async code handling with Maybe, Result, and Task types that are really nice.
Overview
The big new feature is an inspect method and function that allows you to “tap into” a Maybe, Result, or Task to perform side effects safely. This can be helpful for debugging, for adding tracing, or for many other similar things. For example, to debug what value exists in a chain of Maybe operations, you could use the new inspect method like this:
import type Maybe from 'true-myth/maybe';
const log = (value: unknown) => console.log("The value:", value);
const randomInteger = () => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);
const finalMaybe = Maybe.of(randomInteger())
.inspect(log)
.map((n) => n % randomInteger())
.inspect(log)
.andThen((n) => n % 2 === 0 ? Maybe.just(n / 2) : Maybe.nothing())
.inspect(log);For any given run, this will always log two values; it will also log a third when the modulo check passes. The output is the Maybe value.
There are also inspectErr and inspectRejected methods and functions for Result and Task instances respectively.
Changes
🚀 Enhancement
- #1194 feature: add
inspectfunctionality (@chriskrycho)
🐛 Bug Fix
- #1189 Result: fix type-level bugs in
any,all, andtransposeAll(@chriskrycho)
📝 Documentation
- #1155 Fix typo in Task docs (
Task.rejectetoTask.reject) (@kbrgl) - #1150 Docs: fix
jitterexample:Delay->delay(@Zegnat)
🏠 Internal
- #1195 internal: simplify/modernize tsconfig.json configuration (@chriskrycho)
Committers: 3
- Chris Krycho (@chriskrycho)
- Kabir Goel (@kbrgl)
- Martijn van der Ven (@Zegnat)
v9.2.0
True Myth provides safe and idiomatic TypeScript types to handle null, error, and async code handling: Maybe, Result, and Task types that are really nice.
Overview
Adds a flatten helper and method to each of Maybe, Result, and Task to help with the situations where you end up with a nested version of each. For example, with Maybe:
import Maybe from 'true-myth/maybe';
const wrapped = Maybe.of(Maybe.of(123));
console.log(wrapped.toString()); // Just(Just(123))
const flattened = wrapped.flatten();
console.log(flattened.toString()); // Just(123)Note that the method or function removes only a single layer of wrapping.
Changes
🚀 Enhancement
- #1148 Add
flattenfunctions and methods toMaybe,Result, andTask(@chriskrycho)
📝 Documentation
- #1147 docs: remove Node version badge from README (@chriskrycho)
🏠 Internal
- #1146 infra: finish switch-over to Mise from Volta (@chriskrycho)
- #1145 infra: fix Zed Prettier settings (@chriskrycho)
- #1144 infra: drop CI for v8 branch (@chriskrycho)
- #1143 infra: use mise action instead of Volta action (@chriskrycho)
Committers: 2
- 2hu (@2hu12)
- Chris Krycho (@chriskrycho)
v9.1.0
True Myth provides safe and idiomatic TypeScript types to handle null, error, and async code handling: Maybe, Result, and Task types that are really nice.
Overview
v9.1.0 is a fairly full release—thanks to folks for continuing to offer feedback and suggestions for how we can make the library better! This version:
- Adds Standard Schema support (Guide | API Docs).
- Adds
transposeAllandtransposeAnyhelpers for dealing with arrays of results. - Introduces
fromJSONfunctions forMaybeandResultto support round-tripping. - Constrains
Maybeto accept only non-nullable types at construction, rather than only in the return types. - Does some more documentation cleanup.
Changes
🚀 Enhancement
- #1118 feature: implement
fromJSONfunctions (@chriskrycho) - #1116 Maybe: constrain wrapped type to be
{}at construction (@chriskrycho) - #1093 Standard Schema: introduce general-purpose parser support (@chriskrycho)
- #1117 Result: merge multiple results into one (@hannesborch and @chriskrycho)
📝 Documentation
- #1092 docs: fix warnings and errors (@chriskrycho)
🏠 Internal
- #1074 internal: cleanup defunct
ts-ignorepragmas (@chriskrycho) - #1068 internal: simplify build and types (@chriskrycho)
Committers: 2
- Chris Krycho (@chriskrycho)
- Hannes Borch (@hannesborch)
v9.0.1
True Myth provides safe and idiomatic TypeScript types to handle null, error, and async code handling: Maybe, Result, and Task types that are really nice.
Overview
Fixes an assignability bug with the PromiseLike interface and continues cleaning up some docs. This one comes entirely from external contributors—thanks, folks!
Changes
🐛 Bug Fix
📝 Documentation
- #1052 Remove "Why do I need this?" reference (@viniciuskneves)
- #1029 docs/build: add TS 5.8 to matrix (@chriskrycho)
- #1028 docs: clarify public API (@chriskrycho)
🏠 Internal
- #1030 build: check build script in CI (@chriskrycho)
Committers: 3
- Chris Krycho (@chriskrycho)
- Vinicius Kiatkoski Neves (@viniciuskneves)
- @auvred
v9.0.0
True Myth provides safe and idiomatic TypeScript types to handle null, error, and async code handling: Maybe, Result, and Task types that are really nice.
Overview
Now with nicer internals, cleaner public APIs, a brand new docs site! For more details, see the announcement blog post.
Changes
💥 Breaking Change
- #1025 breaking: use lowercase names for root namespace re-exports (@chriskrycho)
- #1023 build: drop CJS build output (@chriskrycho)
- #1019 Maybe: correctly handle arrays which include null and undefined (@chriskrycho)
- #1017 breaking: require Node v20+ for v9 (@chriskrycho)
- #923 Bump minimum TS version to 5.3 (@chriskrycho)
- #921 v9.0: remove deprecated code (@chriskrycho)
🚀 Enhancement
- #1019 Maybe: correctly handle arrays which include null and undefined (@chriskrycho)
- #1018 Maybe: add a new overload for
Maybe.of(unknown) -> Maybe<{}>(@chriskrycho)
📝 Documentation
- #1026 docs: fix missing info in retry status and RetryFailed (@chriskrycho)
- #1024 docs: update measurements of library size (@chriskrycho)
- #1021 docs: fix incomplete sentence (@chriskrycho)
- #1016 docs: update for v9’s TS version support matrix (@chriskrycho)
- #1013 docs: add missing root for
backgroundsection (@chriskrycho) - #1012 docs: update given deprecated code removal for v9 (@chriskrycho)
- #988 docs: new Vitepress-based site (@chriskrycho)
- #927 docs: update README table of contents and installation instructions (@chriskrycho)
🏠 Internal
- #1027 build: fix (p)npm build script tsc invocation (@chriskrycho)
- #1022 Update package.json with relevant changes from v8 branch (@chriskrycho)
- #1020 Maybe: get rid of one cast by calling
nothing()(@chriskrycho) - #1015 cleanup: remove unused
as constannotations (@chriskrycho) - #1014 build: Fix documentation build, and always check it. (@chriskrycho)
- #1008 cleanup: use lowercase name convention for namespaces (@chriskrycho)
- #983 build: use Biome for formatting (@chriskrycho)
- #934 Task (tests): remove dead code after throwing errors (@chriskrycho)
- #922 internal: Introduce a separate CI job for any 8.x work (@chriskrycho)
🗑️ Deprecation
- #1002 Task: rename
Delayre-export todelay(@chriskrycho)
Committers: 2
- Chris Krycho (@chriskrycho)
- Lochlan Bunn (@loklaan)
v8.6.0
True Myth provides safe and idiomatic TypeScript types to handle null, error, and async code handling: Maybe, Result, and Task types that are really nice.
Overview
The headlining feature here is making the andThen and orElse functions work more like people intuitively expect them to! See #1003 for details. Additionally, this fixes a long-standing (but easy-to-miss) bug in the behavior of maybe.get.
This final release in the v8.x series includes all the features which will be present on v9.0. To prepare for the v9.0 release, all you need to do is make sure you are on a sufficiently recent version of TypeScript and switch from any deprecated functions to their supported replacements.
Changes
🚀 Enhancement
- #1003 Feature: generalize inference for
andThenandorElse[backport] (@chriskrycho)
🐛 Bug Fix
- #1011 bug: fix
maybe.gettypes [backport] (@chriskrycho)
Committers: 1
- Chris Krycho (@chriskrycho)
Release 8.5.3
True Myth provides safe and idiomatic TypeScript types to handle null, error, and async code handling: Maybe, Result, and Task types that are really nice.
Changes
🐛 Bug Fix
- #1006 Task:
withRetriesis callable with anyStrategy[backport] (@chriskrycho)
Committers: 1
- Chris Krycho (@chriskrycho)
Release 8.5.2
True Myth provides safe, idiomatic null, error, and async code handling in TypeScript, with Maybe, Result, and Task types that are really nice.
Changes
This mostly comes down to fixing a bug introduced in v8.5.1 in the definition of Strategy, but it brings along some documentation benefits as well.
🐛 Bug Fix
- #1001 Task: define
StrategyasIterator<number>[backport] (@chriskrycho)
📝 Documentation
- #1000 docs: fix incorrect references to safelyTryOr (@chriskrycho)
- #999 docs: fix types in one Result example in the tour [backport] (@chriskrycho)
- #998 docs: add in a missing closing quote [backport] (@chriskrycho)
- #997 docs: fix outdated reference to
Result.tryOrElse[backport] (@chriskrycho) - #996 docs: correct references to
mapandmapRejectedintask[backport] (@chriskrycho) - #995 docs: fix API doc references to
resolvedandrejected[backport] (@chriskrycho)
Committers: 1
- Chris Krycho (@chriskrycho)
Release 8.5.1
True Myth provides safe, idiomatic null, error, and async code handling in TypeScript, with Maybe, Result, and Task types that are really nice.
Overview
The first of what will likely be several 8.5.x bug fix releases to address issues found in the past few months!
Changes
🐛 Bug Fix
- #987 [backport] Fix type definition of
Strategy(@chriskrycho) - #959 Bug:
allandanyshould preserve order of types (@chriskrycho)
Committers: 1
- Chris Krycho (@chriskrycho)