I encountered an issue with a third-party library where the class structure changed. Initially, it was defined as:
export class Foo {
field: X[];
….
}
In my code, I was working with this type:
print(foo.field)
After updating to a new version, the class was updated to:
export class Foo {
readonly foo: readonly X[];
….
}
This change caused my code to throw an error:
Argument of type 'readonly X' is not assignable to parameter of type 'X'.
Here is the function in question:
function print(foo: Foo[]): string {
return //process foo, return some form of string
}
I am seeking guidance on how to resolve this error.