Environments:
- Prettier Version: 3.0.0
- Running Prettier via: n/a / TypeScript
- Runtime: Node v18.16.0, Typescript 5.1
- Operating System: MacOS
- Prettier plugins (if any): Issue happen when writing a plugin
Typescript produce an error when trying to use .map for a property that is a readonly array.
Steps to reproduce:
Using the following typescript code will produce an error when trying to .map a property that is a readonly array(same for .each)
import { AstPath } from "prettier";
interface TestNode {
regularArray: string[];
readonlyArray: readonly string[];
}
const path: AstPath<TestNode> = undefined as any;
// Works fine
path.map(() => "", "regularArray");
// Ts error
path.map(() => "", "readonlyArray");
// ^ Argument of type '"readonlyArray"' is not assignable to parameter of type '"regularArray"'.ts(2345)
Expected behavior:
Should not be any difference between a readonly and regular array.
Actual behavior:
Typescript produce an error when trying to use .map for a property that is a readonly array.

Environments:
Typescript produce an error when trying to use
.mapfor a property that is a readonly array.Steps to reproduce:
Using the following typescript code will produce an error when trying to
.mapa property that is a readonly array(same for.each)Expected behavior:
Should not be any difference between a readonly and regular array.
Actual behavior:

Typescript produce an error when trying to use
.mapfor a property that is a readonly array.