root/global.d.ts:
import {GGMessage} from "./GGMessage";
export {}
declare global {
export interface Window {onWebsocketsMessageReceived: (data: ArrayBuffer) => GGMessage | null}
}
root/src/webSocketProxy.ts:
window.onWebsocketsMessageReceived
PROBLEM - The line above yields:
Error:(30, 36) TS2339: Property 'onWebsocketsMessageReceived' does not exist on type 'Window & typeof globalThis'.
Why is that so? Also, I am pretty sure the entire thing worked just a while ago, though I'm unable to determine the exact changes. Nevertheless, the relevant (provided) things do look to be written properly.
tsconfig.json:
{
"include": [
"src/**/*"
],
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"sourceMap": true,
"outDir": "./dist",
"strict": true,
"noImplicitAny": false,
"strictNullChecks": false,
}
}
d.tsfile. It did the trick for me.