Mark more fields in notebook types as readonly (#161428)

Ran into these while debugging through notebook code. Adding readonly makes it more clear the objects are not mutable

In one case, we were also reversing an array passed to an event. This is not safe as it reverses in place so all event listeners will now see the reversed array
This commit is contained in:
Matt Bierner
2022-09-21 13:16:38 -07:00
committed by GitHub
parent 17bb582b85
commit dedd8bb62d
7 changed files with 53 additions and 50 deletions

View File

@@ -839,7 +839,7 @@ export class NotebookViewModel extends Disposable implements EditorFoldingStateD
private _deltaModelDecorationsImpl(oldDecorations: ICellModelDecorations[], newDecorations: ICellModelDeltaDecorations[]): ICellModelDecorations[] {
const mapping = new Map<number, { cell: CellViewModel; oldDecorations: string[]; newDecorations: IModelDeltaDecoration[] }>();
const mapping = new Map<number, { cell: CellViewModel; oldDecorations: readonly string[]; newDecorations: readonly IModelDeltaDecoration[] }>();
oldDecorations.forEach(oldDecoration => {
const ownerId = oldDecoration.ownerId;