I'm using a 3rd party library that has defined a type like this:
type DefaultButtons = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H';
there is a function that I can call that lets me remove buttons, and it has an api that looks like this:
removeDefaultButtons( buttonsToRemove : DefaultButtons[] );
In my code I know that I would like to keep (say) 'A', 'D' and 'G' but remove all the rest.
Therefore, I'd like to do something like this:
const buttonsToKeep : DefaultButtons[] = ['A', 'D', 'G'];
const allPossibleButtons : DefaultButtons[] = ?? //how to populate this
const removeButtons = allPossibleButtons.filter( b => buttonsToKeep.includes( b ) );
removeDefaultButtons( removeButtons );
The problem is that I'm not sure how I can populate the allPossibleButtons array from the string literal type?