TS2709

Cannot use namespace 'globalThis' as a type.

Broken Code ❌

function parseNumber(this: globalThis, input: string): number {
  return this.parseInt(input);
}
 
parseNumber.call(this, '100');

Fixed Code ✔️

You cannot use a namespace as a type, but you can get the type assigned with that namespace by using the typeof operator:

function parseNumber(this: typeof globalThis, input: string): number {
  return this.parseInt(input);
}
 
parseNumber.call(this, '100');