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

chore(examples): Convert api-routes example to TypeScript #38083

Merged

Conversation

maxproske
Copy link
Contributor

Converted API Routes example over to TypeScript to match the Contribution guidelines.

Documentation / Examples

  • Make sure the linting passes by running pnpm lint
  • The examples guidelines are followed from our contributing doc

@ijjk ijjk added the examples Issue/PR related to examples label Jun 28, 2022
@maxproske maxproske changed the title Convert api-routes example to TypeScript chore(examples): Convert api-routes example to TypeScript Jul 6, 2022
@maxproske maxproske changed the title chore(examples): Convert api-routes example to TypeScript chore(examples): Convert api-routes example to TypeScript Jul 6, 2022
Copy link
Member

@balazsorban44 balazsorban44 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's consider #38091 (comment) on this and all future PRs!

@maxproske
Copy link
Contributor Author

Thanks @balazsorban44 - I made your requested change.

I thought function over const only applied to pages, but I'll consider components going forward.

@maxproske
Copy link
Contributor Author

@balazsorban44 Thanks! Made your requested change, and ready for re-review!

Can I also get confirmation that you recommend export default function over split const/export for components, in addition to pages and API routes in examples?

Copy link
Member

@balazsorban44 balazsorban44 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

As for #38083 (comment), I think, for consistency's sake, we should use function over const/let uniformly, yes. default exports might not be necessary though (unless a page or API route), because a file could export multiple things, but these are stylistic details and a grey area what we should enforce vs. prefer.

So (in my opinion) use function whenever possible, but at the minimum for API Routes and pages. Rest should be at least consistent throughout the example. 👍

@kodiakhq kodiakhq bot merged commit 1d8df75 into vercel:canary Jul 11, 2022
@balazsorban44
Copy link
Member

Opened #38511 to discuss the above and add it to the contributing guidelines

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue/PR related to examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants