Typescript has tuple types which let you define an array with a specific length and types:
let arr: [number, number, number];
arr = [1, 2, 3]; // ok
arr = [1, 2]; // Type '[number, number]' is not assignable to type '[number, number, number]'
arr = [1, 2, "3"]; // Type '[number, number, string]' is not assignable to type '[number, number, number]'
So just use a type like:
handlers: [{handler: string, modifiers: string[]}, string][]
An alternative approach, when this type is only required on the first element:
interface MyInterface {
[index: number]: string[] | [{handler: string, modifiers: string[]}, string];
0: [{handler: string, modifiers: string[]}, string];
}
Or when the type is only valid in first place using Variadic tuple types
type MyType = [[{handler: string, modifiers: string[]}, string], ...string[][]]