Skip to content

v5.4.2-pre.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@coolsoftwaretyler coolsoftwaretyler released this 01 Mar 15:38
· 28 commits to master since this release
d08be68

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

  • Improved typing for union types by @thegedge in #2151 (maybe, see introduction)
  • Eliminate NonEmptyObject by @thegedge in #2152 (maybe, see introduction)
  • Bump typescript from 3.9.10 to 5.3.3 by @thegedge in #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

Community/Developer changes

New Contributors

Full Changelog: v5.4.1...v5.4.2-pre.1