Skip to content

Fix TypeScript errors in endpoints.mdx code snippets#14181

Open
ArmandPhilippot wants to merge 5 commits into
mainfrom
armand/fix-endpoints-code-snippets
Open

Fix TypeScript errors in endpoints.mdx code snippets#14181
ArmandPhilippot wants to merge 5 commits into
mainfrom
armand/fix-endpoints-code-snippets

Conversation

@ArmandPhilippot

@ArmandPhilippot ArmandPhilippot commented Jun 30, 2026

Copy link
Copy Markdown
Member

Description (required)

Follow-up of #14089. TL;DR: Improve UX by preventing the appearance of red squiggles (TS) and visual changes (formatting with Astro extension) when the user copies and pastes the code snippet.

Fixes code snippets in guides/endpoints.mdx:

  • params.id is string | undefined and undefined "cannot be used as an index type". If we narrow the type to string (using APIRoute type parameters), TypeScript complains because a string can't be used for index access... Number() might not be the best (NaN) but it's the easier fix to make it TS friendly.
  • without satisfies APIRoute, TypeScript complains about the destructured properties.
  • TypeScript complains about Buffer and, unlike process.env, there is no clues in the editor to fix this, adding a comment might be helpful
  • missing import

Related issues & labels (optional)

  • Suggested label: code snippet update

@ArmandPhilippot ArmandPhilippot added the code snippet update Updates a code sample: typo, outdated code etc. label Jun 30, 2026
@astrobot-houston

Copy link
Copy Markdown
Contributor

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
en/guides/endpoints.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@ArmandPhilippot ArmandPhilippot changed the title Fix TypeScript errors in guides/endpoints.mdx code snippets Fix TypeScript errors in endpoints.mdx code snippets Jun 30, 2026
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown

Preview deployment

✅ Deployment complete!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code snippet update Updates a code sample: typo, outdated code etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants