i get this error whenever i try to add a function to the global nodejs global namsepace in a TypeScript environment.
Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature
declaring the global namespace
declare global {
namespace NodeJS {
interface Global {
signin(): string[]
}
}
}
so if i try this
global.signin = () => {}
it returns a
Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature
declare global
only works if it is included in the project, and there are a couple of ways to do that. Could you please tell me, in which file do you putdeclare global
? Also, is it in the same file asglobal.signin = () => {}
? – Sulphonamidelet cached = (global as any).mongoose
– Stemson