Skip to content

Fix any usages in the markdown preview sources#300841

Merged
mjbvz merged 1 commit intomicrosoft:mainfrom
mjbvz:dev/mjbvz/honest-thrush
Mar 11, 2026
Merged

Fix any usages in the markdown preview sources#300841
mjbvz merged 1 commit intomicrosoft:mainfrom
mjbvz:dev/mjbvz/honest-thrush

Conversation

@mjbvz
Copy link
Collaborator

@mjbvz mjbvz commented Mar 11, 2026

For #269213

Copilot AI review requested due to automatic review settings March 11, 2026 16:55
@mjbvz mjbvz enabled auto-merge March 11, 2026 16:55
@vs-code-engineering vs-code-engineering bot added this to the 1.112.0 milestone Mar 11, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes remaining any typings in the Markdown preview webview sources to align with the ongoing codebase cleanup in #269213 and reduce fragility from overly-broad type assertions.

Changes:

  • Type acquireVsCodeApi() messaging plumbing using WebviewApi instead of any.
  • Replace any event handling in style-load error tracking with DOM-safe types and null checks.
  • Tighten state and DOM element typings in the preview script (state shape, active line marker, and click target traversal).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
extensions/markdown-language-features/preview-src/messaging.ts Types the VS Code webview API parameter (WebviewApi<unknown>) to remove any from message posting.
extensions/markdown-language-features/preview-src/loading.ts Replaces any in the style error handler with Event | string and safely reads dataset.source.
extensions/markdown-language-features/preview-src/index.ts Types persisted state and tightens DOM click traversal typing to remove any.
extensions/markdown-language-features/preview-src/activeLineMarker.ts Narrows the active element tracking from any to HTMLElement | undefined.

You can also share your feedback on Copilot code review. Take the survey.

@mjbvz mjbvz merged commit 0a2e9ef into microsoft:main Mar 11, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants