jsontokens-js icon indicating copy to clipboard operation
jsontokens-js copied to clipboard

fix: accommodate for optional properties in index signature

Open olistic opened this issue 2 years ago • 4 comments

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 test passes
  • [ ] Changelog is updated
  • [ ] Tag 1 of @person1 or @person2

olistic avatar Jun 26 '23 19:06 olistic

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jun 26 '23 20:06 CLAassistant

@janniks anything else I can do to help landing this?

olistic avatar Aug 12 '24 20:08 olistic

I think it looks good 👍🏻 Thanks for the ping. I'll add a second reviewer as well.

janniks avatar Aug 13 '24 00:08 janniks