error TS1036: Statements are not allowed in ambient contexts.
Broken Code ❌
Fixed Code ✔️
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:
If you don’t want
client to be a
function, you have to use thevar` keyword: