MyGit

v5.4.2-pre.1

mobxjs/mobx-state-tree

版本发布时间: 2024-03-01 23:38:19

mobxjs/mobx-state-tree最新发布版本:v6.0.0(2024-05-07 03:16:58)

Version 5.4.2-pre.1 is an important build for everyone to test out, because it includes some TypeScript changes that could be seen as either bug fixes or breaking changes.

RFC - should we consider these changes bug fixes (bump to 5.4.2) or breaking changes (bump to 6.0.0)

import { t } from "mobx-state-tree";

/**
 * In MobX-State-Tree 5.4.1, this is typed as:
 * ISimpleType<"Red" | "Orange" | "Green">
 */
const namedEnum = t.enumeration("Color", ["Red", "Orange", "Green"]);

/**
 * In MobX-State-Tree 5.4.1, this is typed as:
 * ISimpleType<string>
 */
const anonymousEnum = t.enumeration(["Red", "Orange", "Green"]);

/**
 * If you use mobx-state-tree@5.4.2-pre.1, both of these will be typed as:
 * ISimpleType<"Red" | "Orange" | "Green">
 */

CodeSandbox for version 5.4.1

CodeSandbox for version 5.4.2-pre.1

It's reasonable to call this change a "bug fix", but for projects that relied on the prior behavior, a patch version might "break" their TypeScript types, if they've typed around our existing bug.

The change comes from #2151, which also "fixes" #1525 and #1664 again, by changing types.

We have also removed NonEmptyObject. If a project had relied on that for any kind of type casting, I think that could also be seen as a breaking change.

And of course, we've moved to TypeScript 5.3.3, which shouldn't have a direct impact downstream, but we have previously only called out TS 3.0 or later. This is not strictly a breaking change, and it's technically in line with "TypeScript 3.0 or later", but it could be seen as disruptive to move so far ahead in TypeScript without ample warning in our version.

Breaking Changes

Features

Fixes

Tests

Docs

Community/Developer changes

New Contributors

Full Changelog: https://github.com/mobxjs/mobx-state-tree/compare/v5.4.1...v5.4.2-pre.1

相关地址:原始地址 下载(tar) 下载(zip)

查看:2024-03-01发行的版本