This is likely too close to Generics support, but we could use some way to define arrays with fixed element count and types.
Typescript does it with tuple types:
type StringNumberPair = [string, number];
function doSomething(pair: StringNumberPair) {
const a = pair[0];
// ^ const a: string
const b = pair[1];
// ^ const b: number
// ...
}
doSomething(["hello", 42]);
I think the syntax here could be the same as Typescript's.
This is likely too close to Generics support, but we could use some way to define arrays with fixed element count and types.
Typescript does it with tuple types:
I think the syntax here could be the same as Typescript's.