no-chris / chord-symbol

The definitive chord symbol parser and renderer for Javascript/NodeJS.
https://chord-symbol.netlify.app
MIT License
151 stars 8 forks source link

Created distinct types for parsing success and error #597

Closed darrylnoakes closed 1 year ago

darrylnoakes commented 1 year ago

~Instead of having a single object with all properties optional, use a success property to indicate whether the parsing was successful and use it to create a discriminated union between a data type and a failure type.~

Instead of having a single object with all properties optional, use two types (one for a successfully parsed chord and one for a failure object). They can be discriminated between using the presence or absence of one of the properties.

no-chris commented 1 year ago

Thanks! fyi if you make new commits after the PR review rather than force push the changes it makes the review process easier as you can more easily see the corrections.

I'll merge this and rename the PR for the release notes as I don't use conventional commits in this project

darrylnoakes commented 1 year ago

fyi if you make new commits after the PR review rather than force push the changes it makes the review process easier as you can more easily see the corrections.

Makes sense, I'll remember this if I contribute anything more 👍 Still used to working mostly on personal projects 😄