TS1036

Statements are not allowed in ambient contexts.

Broken Code ❌

import { APIClient } from '../../APIClient';
 
declare global {
  client: APIClient;
}

Fixed Code ✔️

With declare global an ambient context is created. TypeScript does not allow statements in such ambient context declaration which is why we have to change the statement into a declaration:

declare global {
  function client(): APIClient;
}

If you don't want client to be a function, you have to use the var` keyword:

declare global {
  var client: APIClient;
}