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 'json' does not exist on type 'Request' #47

Closed
shrmnk opened this issue Jul 20, 2021 · 2 comments
Closed

Property 'json' does not exist on type 'Request' #47

shrmnk opened this issue Jul 20, 2021 · 2 comments

Comments

@shrmnk
Copy link

shrmnk commented Jul 20, 2021

import { Request } from 'itty-router';

const Update = async (request: Request) => {
  const inputData = await request.json();
  console.log(inputData);
};

Typescript will flag out Line 4 , citing that Property 'json' does not exist on type 'Request'

My quick workaround was to // @ts-ignore the line before

@kwhitley
Copy link
Owner

kwhitley commented Aug 9, 2021

So itty doesn't require a real Request object (keeps it as agnostic/non-prescriptive as possible), but I'll add the basic methods from the native Request as optional methods into the interface file (including json()) to alleviate this... should be publishing in the next few days with a bit of changes, including this.

@kwhitley
Copy link
Owner

Should be fixed as of 2.4 :)

Thanks for your patience!

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