Use as unknown for unimportant as any cases in tests#274577
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors type assertions in terminal test files to use safer TypeScript casting patterns. The changes replace the discouraged as any casts with as unknown as Type assertions, which provides better type safety by requiring an explicit intermediate cast. Additionally, the PR leverages the satisfies operator to ensure partial objects conform to expected types before casting, and removes now-unnecessary eslint-disable comments.
Key Changes
- Replaces
as anytype assertions withas unknown as Typefor improved type safety - Introduces
satisfies Partial<Type>before casting to validate partial object shapes - Removes
eslint-disable-next-line local/code-no-any-castscomments throughout test files
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| xtermTerminal.test.ts | Adds constructor to TestWebglAddon, updates type casts for addon importer and view descriptor |
| shellIntegrationAddon.integrationTest.ts | Converts event array casts and terminal config cast to use as unknown pattern, adds type import |
| terminalService.test.ts | Updates all terminal instance partial objects to use satisfies with as unknown pattern, adds type import |
| terminalProfileService.integrationTest.ts | Refactors backend/environment service mocks to use satisfies pattern, removes unused variable, updates config event casts |
| terminalProcessManager.test.ts | Updates backend service mock to use async/proper typing, fixes config event cast, adds type imports |
| terminalInstance.test.ts | Makes getBackend async, properly types createProcess parameters, adds type imports, fixes capability cast |
| terminalCapabilityStore.test.ts | Converts all capability addition casts to typed as unknown pattern, adds capability type imports |
src/vs/workbench/contrib/terminal/test/browser/terminalProfileService.integrationTest.ts
Show resolved
Hide resolved
lszomoru
approved these changes
Nov 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #269213