v5.4.2-pre.1
版本发布时间: 2024-03-01 23:38:19
mobxjs/mobx-state-tree最新发布版本:v7.0.0-pre.2(2024-08-02 01:56:53)
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.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
- Improved typing for union types by @thegedge in https://github.com/mobxjs/mobx-state-tree/pull/2151 (maybe, see introduction)
- Eliminate
NonEmptyObject
by @thegedge in https://github.com/mobxjs/mobx-state-tree/pull/2152 (maybe, see introduction) - Bump typescript from 3.9.10 to 5.3.3 by @thegedge in https://github.com/mobxjs/mobx-state-tree/pull/2146
Features
- No new features
Fixes
- Some might consider #2146, #2151, and #2152 to be bug fixes, rather than breaking changes.
Tests
- No test-only additions.
Docs
- Docs/update docs homepage by @coolsoftwaretyler in https://github.com/mobxjs/mobx-state-tree/pull/2141
- chore: version bump to 5.4.2-pre.1 by @coolsoftwaretyler in https://github.com/mobxjs/mobx-state-tree/pull/2159
- docs: fix typos in docs update by @coolsoftwaretyler in https://github.com/mobxjs/mobx-state-tree/pull/2142
Community/Developer changes
- Chore/use bun as a package manager and script runner by @coolsoftwaretyler in https://github.com/mobxjs/mobx-state-tree/pull/2148
New Contributors
- @thegedge made their first contribution in https://github.com/mobxjs/mobx-state-tree/pull/2146
Full Changelog: https://github.com/mobxjs/mobx-state-tree/compare/v5.4.1...v5.4.2-pre.1