jsontokens-js
jsontokens-js copied to clipboard
fix: accommodate for optional properties in index signature
Description
This is an alternative to #86, which fixes the index signatures not supporting optional (undefined) values.
#86 modifies the Json type adding undefined to it, which may be considered not technically correct. This PR proposes an alternative way that doesn't touch the Json type.
Type of Change
- Bug fix
Does this introduce a breaking change?
No.
Are documentation updates required?
No.
Testing information
Build the project and verify the TS compiler doesn't show errors in decode.d.ts for optional properties. Example:
Property 'alg' of type 'string | undefined' is not assignable to 'string' index type 'Json'.
Checklist
- [x] Code is commented where needed
- [x] Unit test coverage for new or modified code paths
- [x]
npm run testpasses - [ ] Changelog is updated
- [ ] Tag 1 of @person1 or @person2
@janniks anything else I can do to help landing this?
I think it looks good 👍🏻 Thanks for the ping. I'll add a second reviewer as well.