Skip to content

Reduce ....args: any[] usage#300358

Merged
mjbvz merged 2 commits intomicrosoft:mainfrom
mjbvz:dev/mjbvz/faithful-crow
Mar 10, 2026
Merged

Reduce ....args: any[] usage#300358
mjbvz merged 2 commits intomicrosoft:mainfrom
mjbvz:dev/mjbvz/faithful-crow

Conversation

@mjbvz
Copy link
Copy Markdown
Collaborator

@mjbvz mjbvz commented Mar 10, 2026

We should always default to using any[] for arguments that we forward along. This can catch errors where you accidentally use an argument without type checking

For #269213

Copilot AI review requested due to automatic review settings March 10, 2026 07:03
@mjbvz mjbvz enabled auto-merge March 10, 2026 07:04
@vs-code-engineering
Copy link
Copy Markdown
Contributor

vs-code-engineering bot commented Mar 10, 2026

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@joaomoreno

Matched files:

  • src/vs/base/browser/ui/list/listView.ts

@benibenj

Matched files:

  • src/vs/base/browser/ui/list/listView.ts

@bpasero

Matched files:

  • src/vs/base/parts/ipc/common/ipc.ts
  • src/vs/base/parts/ipc/electron-main/ipcMain.ts

@TylerLeonhardt

Matched files:

  • src/vs/workbench/services/authentication/test/browser/authenticationQueryServiceMocks.ts

Copy link
Copy Markdown
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 continues the #269213 effort to reduce unsafe/fragile ...args: any[] usage (and related any patterns), primarily by tightening rest-parameter types to unknown[] or to existing parameter types.

Changes:

  • Replaces many ...args: any[] rest parameters with unknown[] across core IPC/event/util code paths and tests.
  • Uses type utilities like Parameters<...> to keep overrides aligned with base method signatures.
  • Refines a few internal API/protocol DTO shapes from any[] to unknown[].

Reviewed changes

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

Show a summary per file
File Description
src/vs/workbench/test/browser/window.test.ts Test helper rest args tightened to unknown[].
src/vs/workbench/test/browser/parts/editor/breadcrumbModel.test.ts Uses Parameters<TestConfigurationService['getValue']> instead of any[].
src/vs/workbench/services/userAttention/test/browser/userAttentionService.test.ts Sinon stub rest args tightened to unknown[].
src/vs/workbench/services/authentication/test/browser/authenticationQueryServiceMocks.ts Test call tracking rest args tightened to unknown[].
src/vs/workbench/api/worker/extHostConsoleForwarder.ts Console forwarder callback rest args tightened to unknown[].
src/vs/workbench/api/test/browser/extHostDocumentSaveParticipant.test.ts Test log override rest args tightened to unknown[].
src/vs/workbench/api/node/extensionHostProcess.ts Patched process.on listener rest args tightened to unknown[].
src/vs/workbench/api/node/extHostConsoleForwarder.ts Console forwarder callback rest args tightened to unknown[].
src/vs/workbench/api/node/extHostCLIServer.ts CLI command executor args changed to unknown[].
src/vs/workbench/api/common/extHostCommands.ts Converted-command plumbing now uses unknown[] rest args.
src/vs/workbench/api/common/extHost.protocol.ts Protocol shape uses unknown[] for contributed command args; DTO uses unknown[].
src/vs/workbench/api/common/extHost.api.impl.ts Commands API implementation rest args/thisArg tightened to unknown.
src/vs/platform/instantiation/common/extensions.ts SyncDescriptor ctor cast uses unknown[] rest args.
src/vs/base/parts/ipc/electron-main/ipcMain.ts IPC listener wrapper rest args tightened to unknown[].
src/vs/base/parts/ipc/common/ipc.ts ProxyChannel generated function uses unknown[] rest args.
src/vs/base/common/observableInternal/logging/debugger/rpc.ts Typed RPC proxy methods now use unknown[] rest args.
src/vs/base/common/lifecycle.ts Reference collection acquire args tightened to unknown[].
src/vs/base/common/event.ts DOM/Node event adapter wrapper rest args tightened to unknown[].
src/vs/base/common/decorators.ts Memoize wrapper rest args tightened to unknown[]; removes as any access.
src/vs/base/common/async.ts Attempts to improve scheduler typing; introduces a generic runner.
src/vs/base/browser/ui/list/listView.ts Native DnD data arrays changed from any[] to unknown[].
src/typings/base-common.d.ts Global setInterval signature tightened to unknown[].

Comment thread src/vs/base/common/async.ts
Comment thread src/vs/workbench/api/common/extHostCommands.ts
jrieken
jrieken previously approved these changes Mar 10, 2026
@mjbvz mjbvz merged commit 3aa9077 into microsoft:main Mar 10, 2026
18 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.

4 participants