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

Fix custom APIs types #2421

Open
infomiho opened this issue Dec 17, 2024 · 0 comments
Open

Fix custom APIs types #2421

infomiho opened this issue Dec 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@infomiho
Copy link
Contributor

I was building a custom API endpoint:

import { GetStaticResource } from "wasp/server/api";

export const getStaticResource: GetStaticResource = async (
  req,
  res,
  context
) => {
  return res.json({ message: "Hello from getStaticResource" });
};

When I type res. I don't get any autocomplete. When I clicked through the types of Api I found this:
Image

It complains we are missing @types/express.

And when I changed express to express-serve-static-core, the types auto-complete worked.

Proposed implementation

We should either swap out express for express-serve-static-core when we are after Express types or investigate if there is a better way (a newer way) to get the Express types since Express development started again. (Maybe the solution will be upgrading to Express v5 in the end?)

@infomiho infomiho added the bug Something isn't working label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant