Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloudflare Request type error #762

Open
fwqaaq opened this issue Feb 19, 2025 · 3 comments
Open

Cloudflare Request type error #762

fwqaaq opened this issue Feb 19, 2025 · 3 comments

Comments

@fwqaaq
Copy link
Contributor

fwqaaq commented Feb 19, 2025

Cloudflare Request is different from normal request. It should use this Request by Cloudflare.

export type CloudflareModuleAdapter = (
request: Request,
) => ReqResHandler<Response>;

@KnorpelSenf
Copy link
Member

That makes sense. Could you submit a fix?

We do not want to add a new dependency to the package that contains the types. Instead, we need a minimal type definition that contains all the properties of a CFW request that grammY needs, and that models them in a way that is compatible with CFW's types. That's how the existing adapters work, too.

@fwqaaq
Copy link
Contributor Author

fwqaaq commented Feb 19, 2025

That makes sense. Could you submit a fix?

We do not want to add a new dependency to the package that contains the types. Instead, we need a minimal type definition that contains all the properties of a CFW request that grammY needs, and that models them in a way that is compatible with CFW's types. That's how the existing adapters work, too.

Make sense. Maybe you can use cdn way to add type dependency. Just like this way:

import debug from "https://cdn.skypack.dev/[email protected]";

https://cdn.jsdelivr.net/npm/@cloudflare/workers-types/index.d.ts

@KnorpelSenf
Copy link
Member

No:

We do not want to add a new dependency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants