TS1354

'readonly' type modifier is only permitted on array and tuple literal types.

Broken Code ❌

const users: readonly { name: readonly string }[] = [{ name: 'Alice' }];

This error occurs because readonly is incorrectly applied to a primitive type (string). You cannot mark collective types like string or number as readonly properties.

Fixed Code ✔️

Mark the property as readonly, not the type:

const users: readonly { readonly name: string }[] = [{ name: 'Alice' }];

Now the users array is read-only, and each object's name property is also read-only.