fix(deps): update dependency decoders to v2 #919
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
1.25.5
->2.4.0
Release Notes
nvie/decoders (decoders)
v2.4.0
Compare Source
New features:
.pipe()
method onDecoder
allows you to pass the output of one decoder intoanother:
.then
, but it wasn't as elegant to express..pipe()
can also dynamically select another decoder, based on the input:more human-readable in JSON responses. Compare:
"Value at key "foo": Must be "bar", "qux"" // ❌ Previously
"Value at key 'foo': Must be 'bar', 'qux'" // ✅ Now
New decoders:
identifier
(docs)nanoid()
(docs)Removed decoders:
numericBoolean
decoder, which was deprecated since 2.3.0.v2.3.0
Compare Source
New features:
enum
types are now supported (docs)record(values)
andrecord(keys, values)
forms(docs)
datelike
decoder (docs)bigint
(docs)constant()
andoneOf()
New decoders:
enum_
(see docs)record()
(see docs)select()
(see docs)bigint
(see docs)datelike
(see docs)decimal
(see docs)hexadecimal
(see docs)numeric
(see docs)Renamed decoders:
Some decoders have been renamed because their names were based on Flowisms. Names have
been updated to better reflect TypeScript terminology:
dict()
→record()
maybe()
→nullish()
set()
→setFromArray()
(to make room for a betterset()
decoder in a futureversion)
Deprecated decoders:
The following decoders are deprecated because they were not commonly used, and a bit too
specific to be in the standard library. They are also scheduled for removal in a future
decoders version.
dict()
(preferrecord()
)hardcoded()
(preferalways()
)maybe()
(prefernullish()
)mixed
(preferunknown
)numericBoolean()
Other changes:
positiveNumber
andpositiveInteger
no longer accept-0
as valid inputseither
return type would sometimes get inferred incorrectly if members partiallyoverlapped (see #941)
v2.2.0
Compare Source
Breaking change: Dropped Flow support*.
Breaking change: Projects that are not yet using
strict: true
in theirtsconfig.json
files files are no longer supported. Previously, decoders went to greatlenghts to support both configurations, but the internal typing magic was getting too
complex to maintain without much benefit.
Breaking change: A small breaking change is introduced that removes the need for some
packaging workarounds to support projects using old TypeScript/Node versions. It’s now
simpler to use, and simpler to maintain:
Other, smaller changes, mostly internal:
with and without
strict
mode.(*: I'm still open to bundling Flow types within this package, but only if that can be
supported in a maintenance-free way, for example by using a script that will generate
*.flow
files from TypeScript source files. If someone can add support for that, I'm opento pull requests! 🙏 )
v2.1.0
Compare Source
lib.dom.d.ts
in TypeScriptv2.0.5
Compare Source
positiveInteger(-0)
is now0
, not-0
positiveNumber(-0)
is now0
, not-0
v2.0.4
Compare Source
url
decoder, which could incorrectly reject URLs with a/
in thequery path. Thanks, @gcampax!
v2.0.3
Compare Source
Fix bundling issue where TypeScript types would not get picked up correctly in old
TypeScript versions. Thanks, @robinchow!
Fix TypeScript types for
Result
type to allowimplicit-undefineds.
v2.0.2
Compare Source
formatShort
andformatInline
helper functionsv2.0.1
Compare Source
TypeScript-only: Fix definition of JSONObject to
reflect that its values might always be
undefined
as well.TypeScript-only: Changed return types of
{ [key: string]: T }
toRecord<string, T>
.TypeScript-only: Fine-tune the type of
instanceOf()
.v2.0.0
Compare Source
This is a breaking change, which brings numerous benefits:
Please see the migration guide for precise instructions on how to
adjust your v1 code.
The main change is the brand new
Decoder<T>
API! The tl;dr is:mydecoder(input)
mydecoder.decode(input)
guard(mydecoder)(input)
mydecoder.verify(input)
map(mydecoder, ...)
mydecoder.transform(...)
compose(mydecoder, predicate(...))
mydecoder.refine(...)
describe(mydecoder, ...)
mydecoder.describe(...)
mydecoder(input).value()
mydecoder.value(input)
either
,either3
, ...,either9
either
tuple1
,tuple2
, ...tuple6
tuple
dispatch
taggedUnion
url(...)
httpsUrl
/url
(signature has changed)The full documentation is available on decoders.cc.
Other features:
Other potentially breaking changes:
lemons
has been removedNew decoders:
always
anyNumber
never
prep()
set()
uuid
uuidv1
uuidv4
Other improvements:
optional()
,nullable()
, andmaybe()
now each take an optional 2nd param tospecify a default value
either
sImplementation changes:
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.