You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If an object is run through the decoder at runtime, there should be a way to configure the decoder to throw an error if the decoded object has extra properties not defined on the original decoder.
There should be an additional combinator to make the decoder throw an error given the following input:
constmyTypeRuntimeValue: MyType={myProperty: "someValue",myOtherProperty: "This one isn't defined on the interface"};// I want this to throw an error because myTypeRuntimeValue has// an additional property not defined in the interfaceconstdecoded=MyTypeDecoder.runWithException(myTypeRuntimeValue);
The combinator could be something like exact(value), e.g.
The text was updated successfully, but these errors were encountered:
mrjones2014
changed the title
object decoder should have an option to throw error if extra fields are present
object decoder should have an option to throw error if extra properties are present
Feb 18, 2021
If an object is run through the decoder at runtime, there should be a way to configure the decoder to throw an error if the decoded object has extra properties not defined on the original decoder.
For example, given the following decoder:
There should be an additional combinator to make the decoder throw an error given the following input:
The combinator could be something like
exact(value)
, e.g.The text was updated successfully, but these errors were encountered: