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

Property 'project' does not exist on type 'Request' #22

Open
andyjessop opened this issue Jun 2, 2022 · 2 comments
Open

Property 'project' does not exist on type 'Request' #22

andyjessop opened this issue Jun 2, 2022 · 2 comments

Comments

@andyjessop
Copy link

I'm unable to get type inference working on the withParams helper:

import { Router } from 'itty-router';
import { withParams } from 'itty-router-extras';

export default {
  fetch
};

const router = Router();

router.get('/projects/:project/deployments', withParams, async ({ project }) => {
  console.log(project);
  return new Response();
});

Gives me this error:

Property 'project' does not exist on type 'Request'. ts(2339)
@bkyerv
Copy link

bkyerv commented Aug 23, 2022

you can extend the Request interface and add 'project' type and assign it to 'any' and make it optional

@kwhitley
Copy link
Owner

In the middle of kwhitley/itty-router#121, where I may be rewriting all the types for core (I'm certainly doing it for extras, that are being brought into core), so this is helpful, thanks!

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

3 participants