For example, if I am attaching additional data (in the form of key-value pairs, where the keys are strings) to an array instance, how can I extend the type of this instance of an array to allow for this additional data?
const associativeArray: string[] & Record<string, string> = ['some', 'array', 'data']
/*
Type 'never[]' is not assignable to type 'string[] & Record<string, string>'.
Type 'never[]' is not assignable to type 'Record<string, string>'.
Index signature is missing in type 'never[]'.ts(2322)
*/
associativeArray.customKey = 'customValue'
[...] as anyfor the initial assignment.lengthproperty, and can you guarantee that array methods likepushwouldn't show up as keys?associativeArray.customKey = 'customValue'would not affect thelength, so I would not want the custom keys to affect the array length. I can also guarantee that array methods wouldn't get overridden, but would that guarantee be possible in TypeScript as well?