Change logs for new releases can be found from https://github.com/akheron/optics-ts/releases.
- BREAKING CHANGES
- TypeScript 4.1 or newer is required
.path()
now takes varargs instead of an array. Old:.path(['foo', 'bar', 'baz'])
, new:.path('foo', 'bar', 'baz')
- New features
- Add
.nth()
- Support dotted paths with
.path()
, e.g..path('foo.bar.baz')
.filter()
now narrows the element type if given a type guard- Add
partsOf()
- Add
- Fixes
- Fix
.filter()
to work when adding/removing elements, and document this behavior
- Fix
- New features
- Add
.at()
- Make
.find()
removable
- Add
- Deprecations
- Deprecate
.index()
in favor of.at()
- Deprecate
- Documentation
strictNullChecks
compiler option is required (#5)
- New features
- Change
.index()
to also work on strings - Add
.head()
as an alias to.index(0)
- Add string optics:
.chars()
,.words()
- Add
Setter
optic class - Add setters
.prependTo()
and.appendTo()
- Add top-level
remove()
- Change
.index()
to be removable - Add
.valueOr()
- Change
- Fixes
- Top level
compose()
signatures were totally screwed up
- Top level
- New features
- Add
Getter
,AffineFold
andFold
optic classes - Add
.to()
method for creating Getters
- Add
- Fixes
- Disallow array optics on
T[] | undefined
andT[] | null
- Disallow array optics on
- Initial release