It seems that you can have your interface Bar to be extending Array class:
const foo = Object.assign([1,2,3], {offset: 4});
interface Bar extends Array<Number> {
offset: number;
}
function test(a: Bar) {
console.log(a[0]);
console.log(a.length);
console.log(a.concat);
}
test(foo);
You can read more about Interfaces Extending Classes
UPDATE:
In fact, you can create a separate type using intersections instead of creating a separate interface:
const foo = Object.assign([1,2,3], {offset: 4});
type Bar = number[] & {offset: number};
function test(a: Bar) {
console.log(a[0]);
console.log(a.length);
console.log(a.concat);
}
test(foo);
number[] & { offset: number }? You can't access array methods because you've only provided an index signature, not an array's methods. You need an intersection with an array type.