aydrian
aydrian
CDCloudflare Developers
Created by aydrian on 10/13/2023 in #pages-help
Type safe context in Remix 2.0
I'm working a Remix 2.0 website deployed to Pages. I'm using KV but the context in the action and loader functions don't know about it. I'd rather not copy/paste
interface Env {
CONTENT: KVNamespace;
}
...
let env = context.env as Env;
interface Env {
CONTENT: KVNamespace;
}
...
let env = context.env as Env;
into every page. I've found posts like (https://tom-sherman.com/blog/type-safe-remix-cloudflare-loader-context) but those are from 1.x times and the server files seem different. Has anyone done this?
1 replies