Skip to content

Fix TypeScript errors in view-transitions.mdx code snippets#14182

Open
ArmandPhilippot wants to merge 6 commits into
mainfrom
armand/fix-view-transitions-code-snippets
Open

Fix TypeScript errors in view-transitions.mdx code snippets#14182
ArmandPhilippot wants to merge 6 commits into
mainfrom
armand/fix-view-transitions-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/view-transitions.mdx:

  • add missing Astro.props
  • querySelector can return null
  • event.target.value is not available without narrowing the type
  • redirect can be null when using params.get
  • unclosed <script /> tag
  • consistency: other snippets are wrapped in script tags
  • setupStuff() comes from nowhere, a fake import can be helpful

I haven't updated a few code snippets in view-transitions.mdx as I'm not really familiar with the API but:

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/view-transitions.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.

@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