Why is a readonly tuple's length writable?

Viewed 119

A readonly array has a readonly length:

type Test1 = Pick<readonly string[], 'length'>; // { readonly length: number }

A readonly tuple doesn't:

type Test2 = Pick<readonly [number?], 'length'>; // { length: 0 | 1 }
declare const x: readonly [number?];
x.length = 0; // wat

Why is this? It seems contrary to the purpose of readonly.

1 Answers
Related