JHannTX / angular-practice-food

This is an angular front end website that interacts with various free food apis
0 stars 0 forks source link

Need a better solution to get keys of a typescript interface #2

Open JHannTX opened 1 year ago

JHannTX commented 1 year ago

Currently the fruits service gets the list of all available nutritions to search on from a list that gets populated by hand. It would be ideal to not have to make a list, but instead have the list be generated from the interface itself.

One solution is to use the npm package ts-transformer-keys. The code I would have to write using this package looks very easy to use and to understand. The problem is that typescript itself does not allow an easy way to use custom transformers. This is important to the functioning of the npm package. There are several other options to allow the usage of custom transformers, but investigating them right now would take away from the purpose of this project.

JHannTX commented 1 year ago

This should not have been closed