Skip to content

Conversation

wo-o29
Copy link
Contributor

@wo-o29 wo-o29 commented Aug 26, 2025

For Maintainers

What?

Changed the API route example in the documentation to use .ts file extension for the TypeScript example since it uses TypeScript types.
Added a JavaScript example with .js extension using the switcher prop to provide both TypeScript and JavaScript variants in the docs.

Why?

The existing example used a .js extension but included TypeScript-specific type annotations which is inconsistent and could confuse users.
Providing both TypeScript and JavaScript examples improves clarity and usability, catering to a broader audience.

How?

  • Updated the filename in the TypeScript example code block to pages/api/hello.ts.
  • Added a parallel JavaScript example code block with pages/api/hello.js using the switcher property.
  • Ensured both examples show equivalent handler logic with and without type annotations.

@ijjk ijjk added the Documentation Related to Next.js' official documentation. label Aug 26, 2025
@ijjk
Copy link
Member

ijjk commented Aug 26, 2025

Allow CI Workflow Run

  • approve CI run for commit: 3498e34

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@phottoo
Copy link

phottoo commented Aug 29, 2025

looks good!

@icyJoseph icyJoseph merged commit 4a3ea6a into vercel:canary Aug 29, 2025
63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Related to Next.js' official documentation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants