Global constants/variables

Hello,

I am struggling to create a global.d.ts file of bindings for Pages Functions, much like for Workers. It is my understanding that Functions are essentially workers, so it should work in theory.

However, creating a global.d.ts has no effect. Neither a types.d.ts or a pages.d.ts.

So my question is, how can I create a global binding for KV so I can use it anywhere inside /functions?

export {};

declare global {
	DATABASE: USER_DATABASE;
}

I need to use DATABASE (obviously added as binding already on the Pages project setup) where env is not available, is this possible?

My specific use case is GitHub - lukeed/worktop: The next generation web framework for Cloudflare Workers, where you can see that the usage requires a global constant: GitHub - lukeed/worktop: The next generation web framework for Cloudflare Workers

Please adviseā€¦ many thanks.