In my nextjs project I have this code:
const go = new global.Go()
global.Go is defined through wasm.
When I run the tsc command I get the following error:
error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature.
So I've created the file types/global.d.ts and I have add these lines:
export declare global {
function Go(): unknown
}
but now I get this error:
error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.
How can I solve this issue?
Like the error message says; give it a construct signature
export declare global {
const Go: new () => Go
}