Skip to content

debt: remove any casts#270074

Merged
rzhao271 merged 1 commit intomainfrom
rzhao271/sophisticated-tarsier
Oct 6, 2025
Merged

debt: remove any casts#270074
rzhao271 merged 1 commit intomainfrom
rzhao271/sophisticated-tarsier

Conversation

@rzhao271
Copy link
Collaborator

@rzhao271 rzhao271 commented Oct 6, 2025

Ref #269213

Copilot AI review requested due to automatic review settings October 6, 2025 18:07
@rzhao271 rzhao271 enabled auto-merge (squash) October 6, 2025 18:07
@rzhao271 rzhao271 self-assigned this Oct 6, 2025
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 type assertions (any casts) from the emmet extension codebase to improve type safety and eliminate the need for ESLint suppressions. The changes focus on proper type checking and handling of potentially undefined values.

  • Replaced any casts with proper type guards and null checks
  • Added explicit type validation before accessing object properties
  • Enhanced error handling with better return value patterns

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
extensions/emmet/src/util.ts Removed any cast when checking for 'close' property
extensions/emmet/src/updateImageSize.ts Added type guard for parsedValue property and explicit undefined return
extensions/emmet/src/emmetCommon.ts Removed any casts for insertText and filterText properties with additional null check

}
// eslint-disable-next-line local/code-no-any-casts
else if ('close' in <any>child) {
else if ('close' in child) {
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

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

The type check 'close' in child may not be safe without proper type guards. Consider adding a null/undefined check for child before using the in operator to prevent potential runtime errors.

Suggested change
else if ('close' in child) {
else if (child && 'close' in child) {

Copilot uses AI. Check for mistakes.
}
}
return;
return undefined;
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

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

[nitpick] The explicit return undefined; is consistent with the function's return type, but consider whether this should match the pattern used in getFlatNodeChildren which uses an implicit return for consistency across the codebase.

Suggested change
return undefined;

Copilot uses AI. Check for mistakes.
@rzhao271 rzhao271 added this to the October 2025 milestone Oct 6, 2025
@rzhao271 rzhao271 merged commit b4b3cac into main Oct 6, 2025
28 checks passed
@rzhao271 rzhao271 deleted the rzhao271/sophisticated-tarsier branch October 6, 2025 18:19
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Nov 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants