Correct TypeScript from WorkerEntrypoint Binding

If I have this service below

export default class Users extends WorkerEntrypoint<Env> {
    async fetch() {
        return new Response(null, { status: 404 });
    }

    async list() {
        const adapter = new PrismaD1(this.env.DB);
        const prisma = new PrismaClient({ adapter });

        try {
            const users = await prisma.user.findMany();
            const result = JSON.stringify(users);
            return new Response(result);
        } catch (e) {
            if (e instanceof Prisma.PrismaClientKnownRequestError) {
                return Response.json({ e }, { status: 400 });
            }
            return Response.json({ e }, { status: 500 });
        }
    }


wrangler.toml
name = "users"
main = "src/index.ts"
compatibility_date = "2025-01-09"


When I consume this into another service provider it has in its toml

wrangler.toml
[[services]]
binding = "USERS"
service = "users"
entrypoint = "Users"


When I run wrangler types it generaties this type decleration file

// Generated by Wrangler by running `wrangler types`

interface Env {
    USERS: Fetcher;
}


However when I try to use this service it only shows two methods which are the reserved types connect and fetch
image.png
Was this page helpful?