Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): ⬆️ Upgrade dependency option-t to v51 #448

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Dec 13, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
option-t 39.0.3 -> 51.0.0 age adoption passing confidence

Release Notes

option-t/option-t (option-t)

v51.0.0

Compare Source

Breaking Changes

  • plain_result: Remove unnecessary type parameters from expect operators. #​2420

Internals

  • Disable ESLint's no-redeclare rule for typescript. #​2424

v50.0.2

Compare Source

Documentations

  • Add why we don't provide try! like control flow sugar utility to README. #​2415

Internals

  • Enable require(esm) tests for Node v22. #​2399
  • Update dependencies.
  • Add api typing test framework. #​2419, #​2421
  • Remove unnecessary always-auth from .npmrc. #​2422

v50.0.1

Compare Source

Notable Changes

Update TypeScript to 5.7 #​2412

According to the release blog, we would be able to update TypeScript without the breaking change release of ourselves.

Internals

  • Update dependencies.

Documentation

  • Add the link for v50 release note to docs/migration/README.md. #​2394

v50.0.0

Compare Source

Breaking Changes

Move public APIs that do unsafe operations into unsafe/ subdirs. #​2378

For almost users, this change might not relate.

We provide some unsafe operations for a long time that allow to mutate a value for performance issue or disposing a contained value.
But they are foundamentally unsafe. As a not recommendation to use, we rename some items.

Path
prev now
option-t/plain_option/as_mut option-t/plain_option/unsafe/as_mut
option-t/plain_option/drop option-t/plain_option/unsafe/drop
option-t/plain_result/as_mut option-t/plain_result/unsafe/as_mut
option-t/plain_result/drop option-t/plain_result/unsafe/drop
Exposed Items
path name prev now
option-t/plain_option/unsafe/as_mut asMutOption unsafeAsMutOption
option-t/plain_result/unsafe/as_mut asMutResult unsafeAsMutResult

Announcement

Please use public operators instead of touching fields directly on Result<T, E>

We consider and experiment to overhaul the object shape of Result<T, E> for plain_result in #​2244.
This is not concluded decision, but might happens in near future.

For the safety of future breaking changes,

  1. We recommend to use public operators instead of touching fields directly on Result<T, E>.
  2. We recommend to use TypeScript or some compatible static type checkers.
For simple usecases
Bad
declare const bar: Result<number, string>;

if (bar.ok) { // do not touch `.ok` directly.
    console.log(bar.val); // do not touch `.val` directly.
} else {
    console.log(bar.err);; // do not touch `.err` directly.
}
Nice
import { isOk, unwrapOk, unwrapErr } from 'option-t/plain_result';

declare const bar: Result<number, string>;

if (isOk(bar)) {
    console.log(unwrapOk(bar));
} else {
    console.log(unwrapErr(bar));
}
For library authors that returns a value generated by this library

We recommend to provide some basic operators (isOk, unwrapOk, unwrapErr) as a part of your library, or installing this package as a peer dependencies to avoid to touch fields directly from your library user.

v49.3.0

Compare Source

New Features

Support module-sync export condition. #​2382, #​2381

We support module-sync export condition that is introduced in Node.js v23.0.

Previously, the following code would throw some assertion errors because the backed actual implementation file is different between require() (cjs) and import() (mjs). This is not a problematic for our package due to we don't share an internal state as like illustrate as dual package hazard problem. In some cases, however, some module graphs could take both of esm and cjs variants of same our API. It sometimes increases a final bundled code or require to set multiple breakpoints on debugging.

const viaRequire = require('option-t/nullable');
const viaImport = await import('option-t/nullable');
assert.deepStrictEqual(viaRequire, viaImport);

By this change, the above example code would be fine without any assertion errors if your runtime or module bundler supports this condition. For supported environment, it would always only a esm backed implementation.

Internals

  • Fix ESLint warnings about import/order. #​2373
  • ci: Add Node v23 for unint test job. #​2379

v49.2.1

Compare Source

Documentation

Internals

  • Do not touch object properties directly for plain result. #​2364
  • Use public API as possible for testing for plain result. #​2365
  • Update dependencies.

New Contributors

v49.2.0

Compare Source

Notable Changes

Update TypeScript to 5.6 #​2354

According to the release blog, we would be able to update TypeScript without the breaking change release of ourselves.

Internals
  • Update dependencies.
  • Enable TypeScript's --isolatedDeclarations. #​2327
  • Update pnpm to 9.10.0. #​2353

v49.1.0

Compare Source

Notable Changes

Update TypeScript to 5.5 #​2324

According to the release blog, we would be able to update TypeScript without the breaking change release of ourselves.

Internals
  • Remove `eslint.experimental.useFlatConfig setting. #​2322
  • Update pnpm to 9.4.0. #​2323

v49.0.1

Compare Source

Internals

  • Inline steps for tryCatchIntoResultWithEnsureError(). #​2320

v49.0.0

Compare Source

Breaking Changes

Summary
affected path Changes
option-t/plain_result/unwrap_or_throw_error Moved
option-t/plain_result/unwrap_or_throw_unknown Moved
option-t/plain_result/experimental/try_catch Removed
option-t/plain_result/experimental/try_catch_async Removed
affected path affected items Changes
option-t/plain_result, option-t/plain_result/try_catch tryCatchIntoResultWithEnsureError Behavior Changed
option-t/plain_result, option-t/plain_result/try_catch_async tryCatchIntoResultWithEnsureErrorAsync Behavior Changed
option-t/plain_result/namespace Result.unwrapOrThrowWithEnsureError Behavior Changed
option-t/plain_result/namespace Result.unwrapOrThrowWithEnsureErrorAsync Behavior Changed
Details
Move option-t/plain_result/unwrap_or_throw_error & option-t/plain_result/unwrap_or_throw_unknown to option-t/plain_result/deprecated/ #​2313

They were deprecated paths.
Please rewrite their import path or migrate to use option-t/plain_result/unwrap_or_throw.

Remove deprecated items from option-t/plain_result and option-t/plain_result/namespace. #​2310

These items are removed.

  • option-t/plain_result
    • unwrapOrThrowWithEnsureErrorForResult(): Replace with unwrapOrThrowWithAssertErrorForResult() from option-t/plain_result/deprecated/unwrap_or_throw_error instead.
  • option-t/plain_result/namespace
    • Result.unwrapOrThrowWithEnsureError(): Replace with unwrapOrThrowWithAssertErrorForResult() from option-t/plain_result/deprecated/unwrap_or_throw_error instead.
tryCatchIntoResultWithEnsureError() does not throw TypeError if the passed producer function throws non Error instance of the current realm. #​2307 #​2311 #​2317

This is behavior change.

Previously, their operators throw an error if throw TypeError if the passed producer function throws a value that is not an Error instance of current realm. Even if the thrown value is Error instance of cross-realm (e.g. node:vm or iframe), their operators throws as "not an Error object". It was tricky and strange behavior.

Now, we wrap it with a new Error instance of current realm with setting a value that is not an Error instance of current realm to .cause property of that new Error instance. For almost use case, we think this is not a problematic. But this might change a error telemetry or its stack trace in your observability tools. If would like to use a previous behavior, please use followings:

  • tryCatchIntoResultWithAssertError() from option-t/plain_result/deprecated/try_catch_with_assert_error
  • tryCatchIntoResultWithAssertErrorAsync() from option-t/plain_result/deprecated/try_catch_with_assert_error_async

Please see #​2286 to know why we do this change.

Experimental Features
End of option-t/plain_result/experimental/try_catch & option-t/plain_result/experimental/try_catch_async #​2312

They become new implementations for tryCatchIntoResultWithEnsureError from option-t/plain_result/try_catch (option-t/plain_result/try_catch_async) now. Please use them.

Documentation

  • Add JSDoc to new tryCatchIntoResultWithEnsureError impls. #​2315

v48.2.1

Compare Source

Documentation

Internals

  • Move deprecated items into plain_result/deprecated internally. #​2304

v48.2.0

Compare Source

New Features

Add variants of tryCatchIntoResult that wrapping automatically a thrown something with current realm's Error if it is not an Error instance of current realm. #​2287
  • This is a part of effort to resolve #​2286.
  • This is still experimental. We might change them without any breaking change.

Documentation

  • Update JSDoc for tryCatchIntoWithEnsureError & unwrapOrThrowWithEnsureError when they meet a cross-relam Error instance. #​2289
  • Stop to include docs/ in the published package. #​2273
  • Mark plain_result/unwrap_or_throw_error & plain_result/unwrap_or_throw_unknown as deprecated in docs/public_api_list.md. #​2299
  • Add the link for v49 release note to docs/migration/README.md. #​2298

Internals

  • Update dependencies.
  • Split testcases for plain_result/try_catch into normal fn & async fn. #​2288
  • Deduplicate "an instance of Error of the current realm." string. #​2297
  • Add testcases for dealing with cross-relam Error instance to tryCatchIntoWithEnsureError & unwrapOrThrowWithEnsureError. #​2289

v48.1.0

Compare Source

New Features

  • Export unwrapOrThrowForResult from plain_result. #​2280
  • Export Result.unwrapOrThrow from option-t/plain_result/namespace. #​2280

New Deprecations #​2280

  • unwrapOrThrowWithEnsureErrorForResult() exported from
    • option-t/plain_result.
    • option-t/plain_result/unwrap_or_throw_error.
    • option-t/plain_result/namespace as unwrapOrThrowWithEnsureError().
  • unwrapOrThrowUnknownDirectlyForResult() exported from
    • option-t/plain_result/unwrap_or_throw_unknown.

Their operator rethrow directly the Error contained in a passed result object. However, by rethrowing, its stack trace information lacks the information about where throws it actually. Instead, we recommend to use unwrapOrThrowForResult.

Internals

  • Move CausalCarrierError into the dedicated file. #​2278

v48.0.1

Compare Source

v48.0.0 is missing number due to our release accident.

Breaking Changes

  • Update CausalCarrierError.name to 'CausalCarrierError'. #​2274
  • Stop to export unwrapOrThrowUnknownDirectlyForResult() from ./plain_result. #​2275
    • Result.unwrapOrThrowUnknownDirectly() from option-t/plain_result/namespace is also affected.
    • It was too early.
    • Please import it from option-t/plain_result/unwrap_or_throw_unknown instead.

v48.0.0

Compare Source

v47.0.0

Compare Source

Breaking Changes

Remove deprecated unwrapOrThrowErrorForResult & unwrapOrThrowErrorWithAssertForResult. #​2269

See /docs/migration/v47.md to migrate your code.

Infrastructure

Documentation

v46.3.0

Compare Source

New Feature

  • Implement unwrapOrThrow() for PlainResult. #​2262

v46.2.0

Compare Source

New Features

  • Implement unwrapOrThrowWithEnsureErrorForResult() for option-t/plain_result. #​2264

New Deprecation

  • Deprecate unwrapOrThrowErrorWithAssertForResult() for option-t/plain_result. #​2264
    • Use unwrapOrThrowWithEnsureErrorForResult instead.

v46.1.0

Compare Source

New Features

  • Implement unwrapOrThrowUnknownDirectlyForResult() for option-t/plain_result. #​2261

New Deprecation

  • Deprecate unwrapOrThrowErrorForResult() for option-t/plain_result. #​2259
    • Use unwrapOrThrowErrorWithAssertForResult instead.

Internals

v46.0.0

Compare Source

Breaking Changes

Remove PascalCase style path #​2251

They has been deprecated in v45.2.0.
Please see the release note to migrate your projects.

Documentation

v45.3.0

Compare Source

New Features

  • Expose unwrapOrThrowError from plain_result or plain_result/namespace. #​2253

Internals

Documentation

  • Add the explain about thrown error to the jsdoc for unwrapOrThrowErrorForResult(). #​2254

v45.2.0

Compare Source

New Deprecations

Deprecate old PascalCase style API paths #​2242

The motivation is here (#​1594).
We plan to remove the old PascalCase style path in the next major release. To migrate your code, please try to use the following codemod.

Codemod

Please run the following script by npx jscodeshift --transform <codemod_script>.mjs <target_dir> --parser ts.

// This works with jscodeshift@~0.15.2

const classic = Object.freeze({
    ClassicOption: 'classic_option',
    ClassicResult: 'classic_result',
});

const maybe = Object.freeze({
    Maybe: 'maybe',
    'Maybe/Maybe': 'maybe/maybe',
    'Maybe/and': 'maybe/and',
    'Maybe/andThen': 'maybe/and_then',
    'Maybe/andThenAsync': 'maybe/and_then_async',
    'Maybe/filter': 'maybe/filter',
    'Maybe/filterAsync': 'maybe/filter_async',
    'Maybe/inspect': 'maybe/inspect',
    'Maybe/map': 'maybe/map',
    'Maybe/mapAsync': 'maybe/map_async',
    'Maybe/mapOr': 'maybe/map_or',
    'Maybe/mapOrAsync': 'maybe/map_or_async',
    'Maybe/mapOrElse': 'maybe/map_or_else',
    'Maybe/mapOrElseAsync': 'maybe/map_or_else_async',
    'Maybe/namespace': 'maybe/namespace',
    'Maybe/okOr': 'maybe/ok_or',
    'Maybe/okOrElse': 'maybe/ok_or_else',
    'Maybe/okOrElseAsync': 'maybe/ok_or_else_async',
    'Maybe/or': 'maybe/or',
    'Maybe/orElse': 'maybe/or_else',
    'Maybe/orElseAsync': 'maybe/or_else_async',
    'Maybe/toNullable': 'maybe/to_nullable',
    'Maybe/toPlainResult': 'maybe/to_plain_result',
    'Maybe/toUndefinable': 'maybe/to_undefinable',
    'Maybe/unwrapOr': 'maybe/unwrap_or',
    'Maybe/unwrapOrElse': 'maybe/unwrap_or_else',
    'Maybe/unwrapOrElseAsync': 'maybe/unwrap_or_else_async',
    'Maybe/xor': 'maybe/xor',
    'Maybe/zip': 'maybe/zip',
    'Maybe/zipWith': 'maybe/zip_with',
    'Maybe/zipWithAsync': 'maybe/zip_with_async',
});

const nullable = Object.freeze({
    Nullable: 'nullable',
    'Nullable/Nullable': 'nullable/nullable',
    'Nullable/and': 'nullable/and',
    'Nullable/andThen': 'nullable/and_then',
    'Nullable/andThenAsync': 'nullable/and_then_async',
    'Nullable/filter': 'nullable/filter',
    'Nullable/filterAsync': 'nullable/filter_async',
    'Nullable/inspect': 'nullable/inspect',
    'Nullable/map': 'nullable/map',
    'Nullable/mapAsync': 'nullable/map_async',
    'Nullable/mapOr': 'nullable/map_or',
    'Nullable/mapOrAsync': 'nullable/map_or_async',
    'Nullable/mapOrElse': 'nullable/map_or_else',
    'Nullable/mapOrElseAsync': 'nullable/map_or_else_async',
    'Nullable/namespace': 'nullable/namespace',
    'Nullable/okOr': 'nullable/ok_or',
    'Nullable/okOrElse': 'nullable/ok_or_else',
    'Nullable/okOrElseAsync': 'nullable/ok_or_else_async',
    'Nullable/or': 'nullable/or',
    'Nullable/orElse': 'nullable/or_else',
    'Nullable/orElseAsync': 'nullable/or_else_async',
    'Nullable/toPlainResult': 'nullable/to_plain_result',
    'Nullable/toUndefinable': 'nullable/to_undefinable',
    'Nullable/unwrapOr': 'nullable/unwrap_or',
    'Nullable/unwrapOrElse': 'nullable/unwrap_or_else',
    'Nullable/unwrapOrElseAsync': 'nullable/unwrap_or_else_async',
    'Nullable/xor': 'nullable/xor',
    'Nullable/zip': 'nullable/zip',
    'Nullable/zipWith': 'nullable/zip_with',
    'Nullable/zipWithAsync': 'nullable/zip_with_async',
});

const plainOption = Object.freeze({
    PlainOption: 'plain_option',
    'PlainOption/Option': 'plain_option/option',
    'PlainOption/and': 'plain_option/and',
    'PlainOption/andThen': 'plain_option/and_then',
    'PlainOption/andThenAsync': 'plain_option/and_then_async',
    'PlainOption/asMut': 'plain_option/as_mut',
    'PlainOption/drop': 'plain_option/drop',
    'PlainOption/equal': 'plain_option/equal',
    'PlainOption/filter': 'plain_option/filter',
    'PlainOption/flatten': 'plain_option/flatten',
    'PlainOption/fromResult': 'plain_option/from_result',
    'PlainOption/inspect': 'plain_option/inspect',
    'PlainOption/map': 'plain_option/map',
    'PlainOption/mapAsync': 'plain_option/map_async',
    'PlainOption/mapOr': 'plain_option/map_or',
    'PlainOption/mapOrAsync': 'plain_option/map_or_async',
    'PlainOption/mapOrElse': 'plain_option/map_or_else',
    'PlainOption/mapOrElseAsync': 'plain_option/map_or_else_async',
    'PlainOption/namespace': 'plain_option/namespace',
    'PlainOption/okOr': 'plain_option/ok_or',
    'PlainOption/okOrElse': 'plain_option/ok_or_else',
    'PlainOption/or': 'plain_option/or',
    'PlainOption/orElse': 'plain_option/or_else',
    'PlainOption/orElseAsync': 'plain_option/or_else_async',
    'PlainOption/toNullable': 'plain_option/to_nullable',
    'PlainOption/toUndefinable': 'plain_option/to_undefinable',
    'PlainOption/transpose': 'plain_option/transpose',
    'PlainOption/unwrapOr': 'plain_option/unwrap_or',
    'PlainOption/unwrapOrElse': 'plain_option/unwrap_or_else',
    'PlainOption/unwrapOrElseAsync': 'plain_option/unwrap_or_else_async',
    'PlainOption/xor': 'plain_option/xor',
});

const plainResult = Object.freeze({
    PlainResult: 'plain_result',
    'PlainResult/Result': 'plain_result/result',
    'PlainResult/and': 'plain_result/and',
    'PlainResult/andThen': 'plain_result/and_then',
    'PlainResult/andThenAsync': 'plain_result/and_then_async',
    'PlainResult/asMut': 'plain_result/as_mut',
    'PlainResult/drop': 'plain_result/drop',
    'PlainResult/equal': 'plain_result/equal',
    'PlainResult/flatten': 'plain_result/flatten',
    'PlainResult/fromPromiseSettledResult': 'plain_result/from_promise_settled_result',
    'PlainResult/inspect': 'plain_result/inspect',
    'PlainResult/isErrAnd': 'plain_result/is_err_and',
    'PlainResult/isOkAnd': 'plain_result/is_ok_and',
    'PlainResult/map': 'plain_result/map',
    'PlainResult/mapAsync': 'plain_result/map_async',
    'PlainResult/mapErr': 'plain_result/map_err',
    'PlainResult/mapErrAsync': 'plain_result/map_err_async',
    'PlainResult/mapOr': 'plain_result/map_or',
    'PlainResult/mapOrAsync': 'plain_result/map_or_async',
    'PlainResult/mapOrElse': 'plain_result/map_or_else',
    'PlainResult/mapOrElseAsync': 'plain_result/map_or_else_async',
    'PlainResult/namespace': 'plain_result/namespace',
    'PlainResult/or': 'plain_result/or',
    'PlainResult/orElse': 'plain_result/or_else',
    'PlainResult/orElseAsync': 'plain_result/or_else_async',
    'PlainResult/toNullable': 'plain_result/to_nullable',
    'PlainResult/toUndefinable': 'plain_result/to_undefinable',
    'PlainResult/transpose': 'plain_result/transpose',
    'PlainResult/tryCatch': 'plain_result/try_catch',
    'PlainResult/tryCatchAsync': 'plain_result/try_catch_async',
    'PlainResult/unwrapOr': 'plain_result/unwrap_or',
    'PlainResult/unwrapOrElse': 'plain_result/unwrap_or_else',
    'PlainResult/unwrapOrElseAsync': 'plain_result/unwrap_or_else_async',
    'PlainResult/unwrapOrThrowError': 'plain_result/unwrap_or_throw_error',
});

const undefinable = Object.freeze({
    Undefinable: 'undefinable',
    'Undefinable/Undefinable': 'undefinable/undefinable',
    'Undefinable/and': 'undefinable/and',
    'Undefinable/andThen': 'undefinable/and_then',
    'Undefinable/andThenAsync': 'undefinable/and_then_async',
    'Undefinable/filter': 'undefinable/filter',
    'Undefinable/filterAsync': 'undefinable/filter_async',
    'Undefinable/inspect': 'undefinable/inspect',
    'Undefinable/map': 'undefinable/map',
    'Undefinable/mapAsync': 'undefinable/map_async',
    'Undefinable/mapOr': 'undefinable/map_or',
    'Undefinable/mapOrAsync': 'undefinable/map_or_async',
    'Undefinable/mapOrElse': 'undefinable/map_or_else',
    'Undefinable/mapOrElseAsync': 'undefinable/map_or_else_async',
    'Undefinable/namespace': 'undefinable/namespace',
    'Undefinable/okOr': 'undefinable/ok_or',
    'Undefinable/okOrElse': 'undefinable/ok_or_else',
    'Undefinable/okOrElseAsync': 'undefinable/ok_or_else_async',
    'Undefinable/or': 'undefinable/or',
    'Undefinable/orElse': 'undefinable/or_else',
    'Undefinable/orElseAsync': 'undefinable/or_else_async',
    'Undefinable/toNullable': 'undefinable/to_nullable',
    'Undefinable/toPlainResult': 'undefinable/to_plain_result',
    'Undefinable/unwrapOr': 'undefinable/unwrap_or',
    'Undefinable/unwrapOrElse': 'undefinable/unwrap_or_else',
    'Undefinable/unwrapOrElseAsync': 'undefinable/unwrap_or_else_async',
    'Undefinable/xor': 'undefinable/xor',
    'Undefinable/zip': 'undefinable/zip',
    'Undefinable/zipWith': 'undefinable/zip_with',
    'Undefinable/zipWithAsync': 'undefinable/zip_with_async',
});

const testcaseTable = {
    ...classic,
    ...maybe,
    ...nullable,
    ...plainOption,
    ...plainResult,
    ...undefinable,
};

const map = new Map(
    Object.entries(testcaseTable).map(([oldPath, newPath]) => {
        return [`option-t/${oldPath}`, `option-t/${newPath}`];
    })
);

export const parser = 'tsx';

export default function transformer(fileInfo, api) {
    const j = api.jscodeshift;
    const root = j(fileInfo.source);

    for (const [oldPath, newPath] of map) {
        const isDeprecatedPath = (path) => {
            const source = path.value.source;
            if (!source) {
                return false;
            }

            const ok = source.value === oldPath;
            return ok;
        };

        for (const d of [j.ImportDeclaration, j.ExportAllDeclaration, j.ExportNamedDeclaration]) {
            root.find(d)
                .filter(isDeprecatedPath)
                .find(j.Literal)
                .filter((path) => path.name === 'source')
                .replaceWith((path) => {
                    return j.literal(newPath);
                });
        }
    }

    return root.toSource();
}

Documentations.

  • Update examples section for "how to import". #​2247

Internals

  • Update dependencies.

v45.1.0

Compare Source

New Feature

Experimental

These are still under experimental and unstable. We might change this path and exposed items from here without any breaking change.

  • Add snake_case variants for all subpaths. #​2241
    • When we withdraw this experiment, we'll provides a codemod to back to the previous style.

Documentation

  • Add v42~v45 release notes to docs/migration/README.md. #​2240

v45.0.0

Compare Source

Breaking Changes

Make types both Err.val & Ok.err to null. #​2205

This breaking change does not affect for plain JavaScript code.
This change only affects TypeScript user code.

For this library side, this fixes the long standing issue about mismatching between actual value and types.
For user side, typescript compiler causes a compile error in the place passing a value generated from different version of option-t (~v44) to the current one (v45).

Migration Path
case 1. Update all option-t dependencies (best)
case 2. Use package manager's package alias feature to make a compat bridge them.

E.g.

  • npm install option-t44@&#8203;npm:option-t@^44
  • pnpm add option-t44@&#8203;npm:option-t@^44
import { type Result, createOk, createErr } from 'option-t/PlainResult';
import { Result as OldResult } from 'option-t44/PlainResult/namespace';

export function bridge<T, E>(old: OldResult.Result<T, E>): Result<T, E> {
    if (OldResult.isOk(old)) {
        const val: T = OldResult.unwrapOk(old);
        return createOk<T>(val);
    } else {
        const error: E = OldResult.unwrapErr(old);
        return createErr<E>(error);
    }
}
Use ES2020 as our ESM format. #​2239

Please update your toolchains (including module bundler) to latest version that supports ES2020 syntax.

v44.0.0

Compare Source

Breaking Changes

Export <TypeName> namespace module object only from <TypeName>/namespace. #​2235

Please migrate your code as following:

- import * as Nullable from 'option-t/Nullable/namespace';
+ import { Nullable } from 'option-t/Nullable/namespace';

Internals

  • Use same module structure for ./PlainOption/namespace. #​2234
  • Stop export * as ns syntax. #​2236
  • Add why we don't export self type as Type from <TypeName>/namespace. #​2233Add why we don't export self type as Type from <TypeName>/namespace. #​2233

v43.2.1

Compare Source

Bug Fix

Experiments
  • ./Nullable/ns should export items as Nullable. #​2229

Internals

  • Deduplicate namespace exporting. #​2230
  • Use deep equal to test exported items. #​2231

v43.2.0

Compare Source

New Features

Experiments

These are still under experimental and unstable. We might change this path and exposed items from here without any breaking change.

  • Remove Result.ok() & Result.err() from PlainOption/ns. #​2227
  • Implement ./{Maybe, Nullable, Undefinable}/ns as experimental API`. #​2227

v43.1.0

Compare Source

New Features

  • Implement ./PlainResult/experimental_ns. #​2225
    • This is an experiment for #​2173.
    • This path is still experimental and unstable. We might change this path and exposed items from here without breaking change.

v43.0.1

Compare Source

Internals

  • Update dependencies.
  • Update pnpm to 9.1.0. #​2223
  • Update pnpm-lock.yaml to v9 format. #​2217
  • Cleanup unused test codes. #​2214

Documentation

  • Add the comment that not to recommend to implement PlainResult.{Ok, Err} for your types. #​2213
  • Add the mention about Effect-TS to "Related works" section. #​2216

v43.0.0

Compare Source

Breaking Changes

Remove deprecated classic aliases for ClassOption & ClassResult. #​2201

Some deprecated items has been removed from option-t/ClassicOption and option-t/ClassResult.

For years ago, we added them in dfac180 (v33.9) with the announcement that we plan to remove them in v34 or later.

Internals

  • Add Node.js v22 to CI jobs. #​2211
  • Update dependencies.

v42.1.0

Compare Source

New Features

Internals

  • Enable ESLint's sort-keys for packages/api_tests/__tests__/exposed_path/. #​2200, #​2203
  • Separate code path internally in inspect for PlainResult. #​2198
  • Add comments about why we don't expose operators to compose a data flow from each of root endpoints. #​2197
  • Add why we need to keep simple union for Nullable, Maybe, and Undefinable.#​2196

v42.0.1

Compare Source

What's Changed

v42.0.0

Compare Source

Breaking Changes

Remove deprecated unwrapOrThrowErrorFromResult. #​2191

unwrapOrThrowErrorFromResult in option-t/PlainResult/unwrapOrThrowError has been deprecated in v41.2.0 by the same reason with #​2188.

Please use unwrapOrThrowErrorForResult provided by option-t/PlainResult/unwrapOrThrowError instead.

Unship filter from option-t/{Maybe, Nullable, Undefinable} and option-t/{Maybe, Nullable, Undefinable}/namespace. #​2192

We introduced them in v41.1.0 but it was too early decision.
We unship them from option-t/{Maybe, Nullable, Undefinable} and option-t/{Maybe, Nullable, Undefinable}/namespace.

If you would like to use them, please use option-t/<TypeName>/{filter, filterAsync}.

v41.2.1

Compare Source

Fix Regressions

v41.2.0

Compare Source

New Deprecations

  • Deprecate unwrapOrThrowErrorFromResult in ./PlainResult/unwrapOrThrowError. #​2189

v41.1.0

Compare Source

New Features

Documentation

  • Add jscodeshift codmod example to docs/migration/v41.md. #​2171
  • Add examples to import option-t/<TypeName>/namespace. #​2172
  • Add some notes to examples for option-t/*/namespace. #​2174

Internals

  • Insert more assert to the test for filter for PlainOption. #​2181

v41.0.0

Compare Source

Breaking Changes

This version removed bunch of deprecated items.
See more details https://github.com/option-t/option-t/blob/main/docs/migration/v41.md

  • Remove deprecated NotNullAndUndefined/isNotNullAndUndefined in ./Maybe/Maybe. #​2164
  • Remove deprecated ./<TypeName>/expect & ./<TypeName>/unwrap. #​2165
  • Remove deprecated unwrapOrFrom***/unwrapOrElseFrom***/unwrapOrElseAsyncFrom***. #​2167
  • Drop ./PlainResult/toOption. #​2158
  • Remove deprecated APIs in ./PlainResult/transpose. #​2159
  • Drop deprecated inspectOk/inspectErr/inspectBoth. #​2160

Documentation

v40.7.0

Compare Source

Deprecation

Use For instead of Of preposition to types for ./PlainResult/inspect. #​2161
option-t/PlainResult
  • inspectBothOfResult: Use inspectBothForResult instead.
  • inspectErrOfResult: Use inspectErrForResult instead.
  • inspectOkForResult: Use inspectOkForResult instead.
option-t/PlainResult/inspect
  • inspectBothOfResult: Use inspectBothForResult instead.
  • inspectErrOfResult: Use inspectErrForResult instead.
  • inspectOkForResult: Use inspectOkForResult instead.

Internals

Documentation

  • Add docs/migration/v41.md for the next major release. #​2155

v40.6.1

Compare Source

Documentation

  • Add version info to @deprecated tag added recently. #​2154

v40.6.0

Compare Source

New Deprecation

Use For instead of From preposition to types for unwrapOr/unwrapOrElse/unwrapOrElseAsync. #​2151

It was a long standing issue since 2d77cf8....
By this change, we use From preposition only if an item is designed to type conversion. It simplifies the naming rule and improves naming consistency with mapOr, mapOrElse, or others.

NOTE: We filed #​2152 to clean up this deprecation

Followings are deprecated items:

PlainOption
  • unwrapOrFromOption exported by option-t/PlainOption/unwrapOr or option-t/PlainOption.
    • Use unwrapOrForOption instead.
  • unwrapOrElseFromOption exported by option-t/PlainOption/unwrapOrElse or option-t/PlainOption.
    • Use unwrapOrElseForOption instead.
  • unwrapOrElseAsyncFromOption exported by option-t/PlainOption/unwrapOrElseAsync or option-t/PlainOption.
    • Use unwrapOrElseAsyncForOption instead.
PlainResult
  • unwrapOrFromResult exported by option-t/PlainResult/unwrapOr or option-t/PlainResult.
    • Use unwrapOrForResult instead.
  • unwrapOrElseFromResult exported by option-t/PlainResult/unwrapOrElse or option-t/PlainResult.
    • Use unwrapOrElseForResult instead.
  • unwrapOrElseAsyncFromResult exported by option-t/PlainResult/unwrapOrElseAsync or option-t/PlainResult.
    • Use unwrapOrElseAsyncForResult instead.
Maybe
  • unwrapOrFromMaybe exported by option-t/Maybe/unwrapOr or option-t/Maybe.
    • Use unwrapOrForMaybe instead.
  • unwrapOrElseFromMaybe exported by option-t/Maybe/unwrapOrElse or option-t/Maybe.
    • Use unwrapOrElseForMaybe instead.
  • unwrapOrElseAsyncFromMaybe exported by option-t/Maybe/unwrapOrElseAsync or option-t/Maybe.
    • Use unwrapOrElseAsyncForMaybe instead.
Nullable
  • unwrapOrFromNullable exported by option-t/Nullable/unwrapOror option-t/Nullable.
    • Use unwrapOrForNullable instead.
  • unwrapOrElseFromNullable exported by option-t/Nullable/unwrapOrElseor option-t/Nullable.
    • Use unwrapOrElseForNullable instead.
  • unwrapOrElseAsyncFromNullable exported by option-t/Nullable/unwrapOrElseAsyncor option-t/Nullable.
    • Use unwrapOrElseAsyncForNullable instead.
Undefinable
  • unwrapOrFromUndefinable exported by option-t/Undefinable/unwrapOror option-t/Undefinable.
    • Use unwrapOrForUndefinable instead.
  • unwrapOrElseFromUndefinable exported by option-t/Undefinable/unwrapOrElseor option-t/Undefinable.
    • Use unwrapOrElseForUndefinable instead.
  • unwrapOrElseAsyncFromUndefinable exported by option-t/Undefinable/unwrapOrElseAsyncor option-t/Undefinable.
    • Use unwrapOrElseAsyncForUndefinable instead.

v40.5.1

Compare Source

Documentation

  • Fix the typo about the recommended function name. #​2149

Internals

  • Update dependencies.

v40.5.0

Compare Source

New Deprecations

These items are deprecated.

in option-t/PlainOption #​2143
  • transposeForOption
    • Use transposeOptionToResult in the same module instead.
in option-t/PlainOption/transpose #​2143
  • transposeForOption
    • Use transposeOptionToResult in the same module instead.
in option-t/PlainResult #​2143
  • transposeNullableForResult
    • Use transposeResultToNullable in the same module instead.
  • transposeUndefinableForResult
in option-t/PlainResult/namespace #​2143
  • transposeNullable
    • Use transposeToNullable in the same module instead.
  • transposeUndefinable
    • Use transposeToUndefinable in the same module instead.
in option-t/PlainResult/transpose #​2143
  • transposeForResult
    • Use transposeResultToOption in option-t/PlainOption or option-t/PlainOption/transpose.
  • transposeNullableForResult
    • Use transposeResultToNullable in the same module instead.
  • transposeUndefinableForResult
    • Use transposeResultToUndefinable in the same module instead.
option-t/PlainResult/toOption #​2136
  • toOptionFromOk
    • Use fromOkToOption in option-t/PlainOption/fromResult instead.
  • toOptionFromErr
    • Use fromErrToOption in option-t/PlainOption/fromResult instead.

v40.4.0

Compare Source

New Features

Export more items from option-t/PlainResult. #​2137
  • option-t/PlainResult
    • fromPromiseSettledResultToResult
    • tryCatchIntoResult
    • tryCatchIntoResultAsync
    • tryCatchIntoResultWithEnsureError
    • tryCatchIntoResultWithEnsureErrorAsync

Internals

  • Add some comments about why there are items not exported for ./PlainResult/namespace & ./PlainResult. #​2138
  • Add some comments about why there are items not exported for ./PlainOption/namespace & ./PlainOption. #​2139

v40.3.0

Compare Source

New Features

Export toResult from option-t/{Nullable, Maybe, Undefinable}. #​2133
  • option-t/Nullable
    • toResultErrFromNullable()
    • toResultOkFromNullable()
  • option-t/Maybe
    • toResultErrFromMaybe()
    • toResultOkFromMaybe()
  • option-t/Undefinable
    • toResultErrFromUndefinable()
    • toResultOkFromUndefinable()

Internals

  • Add TODO comments to packages/option-t/src/*/index.ts. #​2132
  • Don't expose asMut() operator from the each of root endpoint. #​2134

v40.2.0

Compare Source

New Features

  • option-t/Nullable #​2127
    • okOrForNullable()
    • okOrElseForNullable()
    • okOrElseAsyncForNullable()
  • from option-t/Maybe #​2128
    • okOrForMaybe()
    • okOrElseForMaybe()
    • okOrElseAsyncForMaybe()
  • option-t/Undefinable #​2129
    • okOrForUndefinable()
    • okOrElseForUndefinable()
    • okOrElseAsyncForUndefinable()
  • option-t/PlainOption #​2130
    • okOrForPlainOption()
    • okOrElseForPlainOption()

v40.1.0

Compare Source

New Features

  • option-t/Nullable #​2124
    • toUndefinableFromNullable()
  • option-t/Nullable/namespace #​2070
    • toResultErr()
    • toResultOk()
  • option-t/Maybe #​2078
    • toNullableFromMaybe()
    • toUndefinableFromMaybe()
  • option-t/Undefinable. #​2125
    • toNullableFromUndefinable()
  • option-t/PlainResult #​2122
    • toNullableFromErr()
    • toNullableFromOk()
    • toUndefinableFromErr()
    • toUndefinableFromOk()
  • option-t/PlainResult/namespace #​2069
    • fromPromiseSettledResult()
    • tryCatchInto()
    • tryCatchIntoAsync()
    • tryCatchIntoWithEnsureError()
    • tryCatchIntoWithEnsureErrorAsync()
  • option-t/PlainOption #​2123
    • toNullableFromOption()
    • toUndefinableFromOption()
  • option-t/PlainOption/namespace #​2053
    • toNullable()
    • toUndefinable()

Internals

  • Add TODO for packages/option-t/src/*/namespace.ts. #​2121

v40.0.0

Compare Source

Breaking Changes

We were burned out to maintain these legacy compats. This release remove them.

Drop legacy option-t/cjs/*. #​2014

Please replace option-t/cjs/* with option-t/*.

Drop option-t/esm/*. #​2017

Please replace option-t/esm/* with option-t/*.

Remove option-t/**/compat/v33. [#​2021](https://redirect.github.com/option

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants