Let's consider a scenario where there is an abstract class:
type Pair = [string, number]
abstract class AbstractPairClass {
pairs: Pair[]
}
When attempting to implement this class as follows:
class ConcretePairClass implements AbstractPairClass {
public pairs = [
['apple', 5],
['banana', 2]
]
}
An error '
(string | number)[][] is not assignable to Pair[]
' occurs.
How can TypeScript be informed that the provided array actually meets the interface requirements?