Using @cloudflare/worker-types for the app.d.ts
              
              #4898
            
            
          -
| Is it possible to jack something from  There's a comment here: 
 
 I'm looking for an example of this somewhere. The env is always a generic in  Any pointers appreciated. | 
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 11 replies
-
| Edited to reflect current best practices Hopefully this gives you a pointer to solving your case, this is what I'm doing at the moment: // /src/app.d.ts
declare global {
	interface Window {
		someObnoxiousGlobalObjectFromAdVendor: any;
	}
	namespace App {
		interface Error {
			code?: string; // we always have 'message', but adding code
		}
		interface Locals {
			user?: import('$lib/types').User; // in case you have users
		}
		interface PageData {
			someDataYouLike?: import('$lib/types').LikedData; // $page.data.someDataYouLike
		}
		interface Platform {
			cf?: IncomingRequestCfProperties;
			env?: {
				CF_PAGES_COMMIT_SHA: string; // I use this for Kit version
				SOME_KV_BINDING: KVNamespace;
			};
		}
	}
}
export {}; | 
Beta Was this translation helpful? Give feedback.
-
| @jokull @colinhowells Mind if I ask why  I'm trying out Cloudflare's D1 database.  There's an example app that I've only managed to get working by creating the Sveltekit project with TypeScript.  It didn't work if I created it with JsDoc.  If I create a new SK project with just javascript, there is no   | 
Beta Was this translation helpful? Give feedback.
-
| I'm jumping in this pretty old thread already, I'm facing an issue in SvelteKit. I've been doing the following: Using the Message type from Database, to make it available without import, similar to what an  My life has been great, until today: I installed Sentry, and Sentry depends on  I tried moving my Message type into an ambient file, or within my lib folder as .d.ts file, none of these option work. Am I missing a way to avoid this type contamination? | 
Beta Was this translation helpful? Give feedback.
Edited to reflect current best practices
Hopefully this gives you a pointer to solving your case, this is what I'm doing at the moment: