Skip to content

Releases

v0.12.0

Choose a tag to compare

@github-actions github-actions released this 28 Oct 14:51
Immutable release. Only release title and notes can be modified.
193823d

Upgrading

  • A payload can no longer hold a bigint, because JSON.stringify throws on one (#106). Keep an
    integer in the safe range of number as number, and one outside it as a decimal string.
    Large integers shows the
    pattern.

What's Changed

💥 Breaking

  • fix!: drop bigint from the allowed payload types by @jo16oh in #106

Full Changelog: v0.11.0...v0.12.0

v0.11.0

Choose a tag to compare

@github-actions github-actions released this 28 Oct 06:27
Immutable release. Only release title and notes can be modified.
8ee18e5

This release reworks the companion API. Code written for 0.10 needs the changes below.

Upgrading

  • Import Enum, Trait, Tag and Otherwise from valof. valof/experimental is removed (#98).

  • End every companion chain with .build(), for Val, Enum and Trait (#86):

    const User = Val.companion<User>().build();
  • Replace Val.sealer<User>() with Val.companion<User>(), and User(payload) with
    User.seal(payload) (#82). A companion is not callable. Replace Enum.sealer the same way.

  • Pass impl and implTrait a function that returns the members (#92). The function receives
    seal, patch and create when implCreate registered one. A member that calls them needs no
    return-type annotation:

    // before
    .impl({ renamed: (u, name: string): User => User.patch(u, { name }) })
    // after
    .impl(({ patch }) => ({ renamed: (u, name: string) => patch(u, { name }) }))
  • Replace .fixed<"id">() with a type argument: Val.companion<User, [Unpatchable<"id">]>() (#83).

  • Replace pipe(u, User.greet()) with pipe(u, User.greet), where the member's only parameter is
    the value. User.greet() is now a type error (#97).

  • Replace Shape.__valof_tag with Shape[Tag] (#90).

  • Remove detached-impl from your valof-lint config (#86).

Enums

Write each variant's steps in the chain after the variant's name, as .Click.implSeal, and declare
a renamed tag with .tag("kind") (#87). implVariant and the companion("kind") argument are
removed:

// before
Enum.companion<Event>("kind")
  .implSeal(checkId)
  .implVariant("Click", (variant) => variant.implSeal(checkClick).impl({ moved }))
  .build();

// after
Enum.companion<Event>()
  .tag("kind")
  .Click.implSeal(checkClick)
  .Click.impl(() => ({ moved }))
  .implSeal(checkId)
  .build();

Warning

An implSeal on the enum, not on a variant, now runs only in Event.seal.
Event.Click.seal, Event.Click.create and Event.Click.patch skip it. Where a check must run
on every variant, move it into each variant's implSeal.

Replace Shape.Circle({ r: 2 }) with Shape.Circle.create({ r: 2 }). A variant's seal expects
the payload including the tag: Shape.Circle.seal({ _tag: "Circle", r: 2 }).

What's Changed

💥 Breaking

  • feat!: drop .sealer, make .seal the only way in, and .companion offers default .seal by @jo16oh in #82
  • feat!: replace .fixed with Unpatchable, and add PrivateSeal, as companion type arguments by @jo16oh in #83
  • feat!: close every companion chain with .build() by @jo16oh in #86
  • feat!: rebuild the Enum API as one chain by @jo16oh in #87
  • feat!: turn the __valof_ keys into symbols by @jo16oh in #90
  • feat!: take the members of impl and implTrait through a function by @jo16oh in #92
  • feat!: drop the value-last form from a member taking only the value by @jo16oh in #97
  • feat!: drop valof/experimental, and export Enum and Trait from the root by @jo16oh in #98

✨ Features

  • feat: add _ to match for the variants without a handler of their own by @jo16oh in #80
  • feat: allow any variant name and a then member by @jo16oh in #91
  • feat: add implAssoc for members that do not take the value by @jo16oh in #95

🔧 Fixes

  • fix: let a consumer emit declarations for an exported companion by @jo16oh in #88
  • fix: throw in development on a member hiding a default or a rest parameter by @jo16oh in #102

⚡ Performance

  • perf: share the builder steps between Val and Enum by @jo16oh in #93
  • perf: wrap what a step's function receives in NoInfer by @jo16oh in #94

📝 Docs

  • docs: state the TypeScript requirement in the README, and rewrite the enums chapter by @jo16oh in #96
  • docs: merge the README examples into one by @jo16oh in #99
  • docs: fix factual errors, and proofread the book and the hovers by @jo16oh in #100
  • docs: restructure the book by @jo16oh in #101

Full Changelog: v0.10.0...v0.11.0

v0.10.0

Choose a tag to compare

@github-actions github-actions released this 20 Oct 15:29
Immutable release. Only release title and notes can be modified.
6b54f81

What's Changed

💥 Breaking

  • feat!: make companion members data-first and data-last by @jo16oh in #78

Full Changelog: v0.9.1...v0.10.0

v0.9.1

Choose a tag to compare

@github-actions github-actions released this 20 Oct 01:15
Immutable release. Only release title and notes can be modified.
4741e91

What's Changed

🔧 Fixes

  • fix: reserve the step names, not every name starting with impl by @jo16oh in #72
  • fix: reject non-objects for an empty payload by @jo16oh in #71
  • fix: reject a trait member's name in an enum's impl by @jo16oh in #73
  • fix: include a trait's fields in a Val's payload type by @jo16oh in #74

⚡ Performance

  • perf: export Val, Enum and Trait as namespaces by @jo16oh in #70

Full Changelog: v0.9.0...v0.9.1

v0.9.0

Choose a tag to compare

@github-actions github-actions released this 14 Oct 13:10
Immutable release. Only release title and notes can be modified.
7c0751d

Upgrading from 0.8

implSeal now rejects a seal whose return type includes a PromiseLike. Do the async work first,
and pass its result to the seal.

What's Changed

💥 Breaking

  • feat!: require a seal to return synchronously by @jo16oh in #64

✨ Features

  • feat: reject another variant's fields in the enum's seal, and add [Tag] by @jo16oh in #63
  • feat: add .implCreate.noseal for bypassing the seal in create by @jo16oh in #65

🔧 Fixes

  • fix(lint): stop reporting implEquals in detached-impl by @jo16oh in #59
  • fix(lint): skip reserved names in unused-member by @jo16oh in #60
  • fix: reject trait members that overwrite a name the companion holds by @jo16oh in #62

📝 Docs

  • docs: describe valof as a library for branded, immutable domain types by @jo16oh in #57
  • docs: describe .implCreate.noseal in custom constructors by @jo16oh in #66

Full Changelog: v0.8.2...v0.9.0

v0.8.2

Choose a tag to compare

@github-actions github-actions released this 24 Sep 08:04
Immutable release. Only release title and notes can be modified.
5f0d538

What's Changed

🔧 Fixes

  • feat(enum): implement a trait without passing its companion by @jo16oh in #46
  • fix: strip nested brands in PayloadOf by @jo16oh in #49

🧹 Everything else

  • docs: say which fields a box exposes, and narrow the colon rule by @jo16oh in #48

Full Changelog: v0.8.1...v0.8.2

v0.8.1

Choose a tag to compare

@github-actions github-actions released this 19 Sep 03:52
Immutable release. Only release title and notes can be modified.
827d9ba

What's Changed

📝 Docs

🧹 Everything else

Full Changelog: v0.8.0...v0.8.1

v0.8.0

Choose a tag to compare

@github-actions github-actions released this 19 Sep 03:33
Immutable release. Only release title and notes can be modified.
a19f6cb

What's Changed

💥 Breaking

  • fix!: close three patch holes that produced incomplete values by @jo16oh in #32
  • feat!: remove update by @jo16oh in #33
  • feat!: replace custom equality with named equals by @jo16oh in #36
  • feat: Enum by @jo16oh in #41

✨ Features

  • feat: publish Trait from valof/experimental by @jo16oh in #27
  • feat: add nocopy sealing by @jo16oh in #37
  • feat: let a Val reference itself with Rec by @jo16oh in #42

🔧 Fixes

  • fix: strengthen seal integrity by @jo16oh in #35

📝 Docs

  • docs: move the reference into a book, published per tag by @jo16oh in #31

🧹 Everything else

  • chore: introduce mise by @jo16oh in #30
  • test: write payloads plain, without readonly by @jo16oh in #34
  • chore: check bundle-size claims by release scope by @jo16oh in #38
  • test: typecheck README examples by @jo16oh in #39
  • chore: check release claims before push by @jo16oh in #40

Full Changelog: v0.7.0...v0.8.0

v0.7.0

Choose a tag to compare

@github-actions github-actions released this 10 Sep 14:30
Immutable release. Only release title and notes can be modified.
fb77559

What's Changed

💥 Breaking

  • feat!: reject null in top-level payloads by @jo16oh in #28

Full Changelog: v0.6.0...v0.7.0

v0.6.0

Choose a tag to compare

@github-actions github-actions released this 09 Sep 08:06
Immutable release. Only release title and notes can be modified.
234a1ad

What's Changed

✨ Features

  • feat(lint): add five rules for Val/companion misuse by @jo16oh in #25

Full Changelog: v0.5.0...v0.6.0