Closed
Description
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
MatPaginator requires pageSizeOptions
to be a mutable array. Passing in a ReadonlyArray fails.
Reproduction
Steps to reproduce:
@Component({
selector: 'example-component',
template: '<mat-paginator [pageSizeOptions]="pageSizeOptions"></mat-paginator>',
})
export class ExampleComponent {
pageSizeOptions: ReadonlyArray<number> = [10, 20];
}
https://stackblitz.com/edit/components-issue-rvmtli?file=src/app/example-component.ts
Expected Behavior
I am unaware that MatPaginator would mutate the passed in Array. Passing in a ReadonlyArray should work.
Actual Behavior
Throws
The type 'readonly number[]' is 'readonly' and cannot be assigned to the mutable type 'number[]'.
Environment
- Angular: ^12.2.9
- CDK/Material: ^12.2.9
- TypeScript: ^3.7.5
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): macOS