Q:

Changing a property modifier when merging an interface

The Window interface has a few properties that are readonly:
interface Window extends ... {
  // ...
  readonly innerHeight: number;
  readonly innerWidth: number;
  // ...
}

I get that those cannot really be changed, but in my unit tests, I'm changing the values of the object to simulate the changes. And it's an object of that type.
Is there a way I can augment that type in a custom d.ts file and change these properties modifiers? 
I tried to just create a .d.ts file with this:
interface Window {
  innerHeight: number;
  innerWidth: number;
}

But the compiler is complaining with:
All declarations of 'innerWidth' must have identical modifiers.

A:

(I'm pretty sure that) no, you can't change the modifiers or types of existing types.
But as you're only using it for testing then it shouldn't be problematic to cast it to any:
(window as any).innerWidth = 500;
(window as any).innerHeight = 300;

Edit
There's a trick to make a type mutable:
type Mutable<T extends { [x: string]: any }, K extends string> = {
    [P in K]: T[P];
}

type MyWindow = Mutable<Window, keyof Window>;
(window as MyWindow).innerWidth = 500;
(window as MyWindow).innerHeight = 300;

(code in playground)
It was suggested in this issue: Mapped Types syntax to remove modifiers, but if it's for testing then this is probably an overkill and casting to any would do the trick (in my opinion).

