I want to create a type that only accepts a specific combination of array values regardless of their order.
For example:
const acceptedCombo = ['a', 'b'];
function foo(param: MyType) {}
// Possible combos:
['a', 'b'] // OK
['b', 'a'] // OK
['a', 'b', 'c'] // TypeError - "c" is extra
['a'] // TypeError - "b" is missing
How can I define MyType
?