Skip to content

[Shared] .deserialize should throw on an invalid input, rather than returning undefined #224

Description

@JayPanoz

From @tefkah in Discord

i find it very tricky to figure out why Manifest.deserialize is not deserializing my input correctly. if it were to throw in place of return;, i could at least figure out where its going wrong (still a bit tricky with the minified code, but much easier!)
currently what i end up doing is just pulling down the ts-toolkit and stepping through parsing it w a debugger, which feels more involved than needed
but its def possible i may be missing some obvious way to accomplish all of the above here!
heres a repro for 2: https://codesandbox.io/p/github/tefkah/readium-parse-repro/main (apparently codesandbox is shutting down on in mid june,otherwise just look here: https://github.com/tefkah/readium-parse-repro)

I agree this is quite an issue because we do not like to waste time on debugging things a contextualised error would easily clarify. I personally find this a shortcoming that warrants a breaking change if it makes developers’ life easier

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions