Skip to content

v2.4.0

Choose a tag to compare

@leafo leafo released this 30 Oct 07:16
· 67 commits to master since this release

What's New

  • add types.metatable_is(t) type constructor for testing the type of a table's metatable
  • add types.clone as a special type checker that will shallow clone an object via its transformation (that is valid to be cloned)
  • add types.null as an alias for nil checker, so you can reference it without quoting it in Lua
  • add __tostring metamethod on all type objects. Converting a type object into a string will display its description

Bug Fixes

  • MoonScript type checkers for instances no longer incorrectly return true when passed class objects. They will only return true when passed an appropriate instance of a MoonScript class
  • is_type does not incorrectly return true when passed a class object extended from BaseType. It only returns true when passed an instance of a type checker. For example, passing in a type constructor types.is_type(types.shape) used to return true but now correctly returns false. The result of types.is_type(types.shape({...})) will still correctly return true`

Misc

  • Minor refactoring of internal code with regard to describing nodes
  • Clarify many parts of the documentation regarding how state works
  • Write clear example about transform and avoiding mutating objects

Full Changelog: v2.3.0...v2.4.0