3 ms·
I’m not at a computer now, but you can explicitly define a tuple type like: type Tuple<T, K> = [T, K | null]; Which is my first thought, but I can’t test
by 52-6F-62 7y ago
I’m not at a computer now, but you can explicitly define a tuple type like:
type Tuple<T, K> = [T, K | null];
Which is my first thought, but I can’t test it against the compiler at the moment and I’m not sure if I’m missing something.
...JavaScript would allow you to extend that list during runtime (unless you freeze it)
type Tuple<T, K> = [T, K]
const Tuple<T, K> = (x: T, y: K): Tuple<T, K> => {
const tup = [x, y];
Object.freeze(tup);
return tup;
};