Skip to content

Commit 5886936

Browse files
authored
Merge pull request #280122 from microsoft/ben/redundant-skink
Reduce use of explicit `any` type (#274723)
2 parents 334cc09 + 99d3072 commit 5886936

File tree

9 files changed

+15
-22
lines changed

9 files changed

+15
-22
lines changed

eslint.config.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -600,15 +600,11 @@ export default tseslint.config(
600600
'src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.ts',
601601
'src/vs/workbench/contrib/accessibilitySignals/browser/commands.ts',
602602
'src/vs/workbench/contrib/authentication/browser/actions/manageTrustedMcpServersForAccountAction.ts',
603-
'src/vs/workbench/contrib/bulkEdit/browser/bulkCellEdits.ts',
604603
'src/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.ts',
605604
'src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPane.ts',
606605
'src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPreview.ts',
607606
'src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.ts',
608607
'src/vs/workbench/contrib/chat/browser/actions/chatContextActions.ts',
609-
'src/vs/workbench/contrib/chat/browser/chatAttachmentWidgets.ts',
610-
'src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationWidget.ts',
611-
'src/vs/workbench/contrib/chat/browser/chatContentParts/chatMultiDiffContentPart.ts',
612608
'src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.ts',
613609
'src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.ts',
614610
'src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.ts',
@@ -632,7 +628,6 @@ export default tseslint.config(
632628
'src/vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsOutline.ts',
633629
'src/vs/workbench/contrib/codeEditor/electron-browser/selectionClipboard.ts',
634630
'src/vs/workbench/contrib/commands/common/commands.contribution.ts',
635-
'src/vs/workbench/contrib/comments/browser/commentsAccessibleView.ts',
636631
'src/vs/workbench/contrib/comments/browser/commentsTreeViewer.ts',
637632
'src/vs/workbench/contrib/comments/browser/commentsView.ts',
638633
'src/vs/workbench/contrib/comments/browser/reactionsAction.ts',
@@ -675,7 +670,6 @@ export default tseslint.config(
675670
'src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts',
676671
'src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.ts',
677672
'src/vs/workbench/contrib/markdown/browser/markdownDocumentRenderer.ts',
678-
'src/vs/workbench/contrib/markdown/browser/markdownSettingRenderer.ts',
679673
'src/vs/workbench/contrib/markers/browser/markers.contribution.ts',
680674
'src/vs/workbench/contrib/markers/browser/markersView.ts',
681675
'src/vs/workbench/contrib/mergeEditor/browser/commands/commands.ts',
@@ -758,7 +752,6 @@ export default tseslint.config(
758752
'src/vs/workbench/contrib/tasks/common/taskSystem.ts',
759753
'src/vs/workbench/contrib/tasks/common/tasks.ts',
760754
'src/vs/workbench/contrib/testing/common/storedValue.ts',
761-
'src/vs/workbench/contrib/testing/common/testItemCollection.ts',
762755
'src/vs/workbench/contrib/testing/test/browser/testObjectTree.ts',
763756
'src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.ts',
764757
'src/vs/workbench/contrib/typeHierarchy/common/typeHierarchy.ts',
@@ -768,7 +761,6 @@ export default tseslint.config(
768761
'src/vs/workbench/contrib/webviewPanel/browser/webviewEditor.ts',
769762
'src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.ts',
770763
'src/vs/workbench/contrib/webviewPanel/browser/webviewWorkbenchService.ts',
771-
'src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts',
772764
'src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService.ts',
773765
'src/vs/workbench/contrib/welcomeWalkthrough/browser/walkThroughPart.ts',
774766
'src/vs/workbench/services/authentication/common/authentication.ts',

src/vs/workbench/contrib/bulkEdit/browser/bulkCellEdits.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { IEditorService } from '../../../services/editor/common/editorService.js
1919

2020
export class ResourceNotebookCellEdit extends ResourceEdit implements IWorkspaceNotebookCellEdit {
2121

22-
static is(candidate: any): candidate is IWorkspaceNotebookCellEdit {
22+
static is(candidate: unknown): candidate is IWorkspaceNotebookCellEdit {
2323
if (candidate instanceof ResourceNotebookCellEdit) {
2424
return true;
2525
}

src/vs/workbench/contrib/chat/browser/chatAttachmentWidgets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ function setResourceContext(accessor: ServicesAccessor, scopedContextKeyService:
11311131
return resourceContextKey;
11321132
}
11331133

1134-
function addBasicContextMenu(accessor: ServicesAccessor, widget: HTMLElement, scopedContextKeyService: IScopedContextKeyService, menuId: MenuId, arg: any, updateContextKeys?: () => Promise<void>): IDisposable {
1134+
function addBasicContextMenu(accessor: ServicesAccessor, widget: HTMLElement, scopedContextKeyService: IScopedContextKeyService, menuId: MenuId, arg: unknown, updateContextKeys?: () => Promise<void>): IDisposable {
11351135
const contextMenuService = accessor.get(IContextMenuService);
11361136
const menuService = accessor.get(IMenuService);
11371137

src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationWidget.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export interface IChatConfirmationWidgetOptions<T> {
4646
message: string | IMarkdownString;
4747
subtitle?: string | IMarkdownString;
4848
buttons: IChatConfirmationButton<T>[];
49-
toolbarData?: { arg: any; partType: string; partSource?: string };
49+
toolbarData?: { arg: unknown; partType: string; partSource?: string };
5050
silent?: boolean;
5151
}
5252

@@ -330,7 +330,7 @@ export interface IChatConfirmationWidget2Options<T> {
330330
icon?: ThemeIcon;
331331
subtitle?: string | IMarkdownString;
332332
buttons: IChatConfirmationButton<T>[];
333-
toolbarData?: { arg: any; partType: string; partSource?: string };
333+
toolbarData?: { arg: unknown; partType: string; partSource?: string };
334334
}
335335

336336
abstract class BaseChatConfirmationWidget<T> extends Disposable {

src/vs/workbench/contrib/chat/browser/chatContentParts/chatMultiDiffContentPart.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export class ChatMultiDiffContentPart extends Disposable implements IChatContent
136136
const setupActionBar = () => {
137137
actionBar.clear();
138138

139-
let marshalledUri: any | undefined = undefined;
139+
let marshalledUri: unknown | undefined = undefined;
140140
let contextKeyService: IContextKeyService = this.contextKeyService;
141141
if (this.editorService.activeEditor instanceof ChatEditorInput) {
142142
contextKeyService = this.contextKeyService.createOverlay([

src/vs/workbench/contrib/comments/browser/commentsAccessibleView.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { COMMENTS_VIEW_ID, CommentsMenus } from './commentsTreeViewer.js';
1515
import { CommentsPanel, CONTEXT_KEY_COMMENT_FOCUSED } from './commentsView.js';
1616
import { IViewsService } from '../../../services/views/common/viewsService.js';
1717
import { ICommentService } from './commentService.js';
18+
import { CommentNode } from '../common/commentModel.js';
1819
import { CommentContextKeys } from '../common/commentContextKeys.js';
1920
import { moveToNextCommentInThread as findNextCommentInThread, revealCommentThread } from './commentsController.js';
2021
import { IEditorService } from '../../../services/editor/common/editorService.js';
@@ -76,7 +77,7 @@ class CommentsAccessibleContentProvider extends Disposable implements IAccessibl
7677
public readonly actions: IAction[];
7778
constructor(
7879
private readonly _commentsView: CommentsPanel,
79-
private readonly _focusedCommentNode: any,
80+
private readonly _focusedCommentNode: CommentNode,
8081
private readonly _menus: CommentsMenus,
8182
) {
8283
super();

src/vs/workbench/contrib/markdown/browser/markdownSettingRenderer.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ export class SimpleSettingRenderer {
2020
private readonly codeSettingAnchorRegex: RegExp;
2121
private readonly codeSettingSimpleRegex: RegExp;
2222

23-
private _updatedSettings = new Map<string, any>(); // setting ID to user's original setting value
23+
private _updatedSettings = new Map<string, unknown>(); // setting ID to user's original setting value
2424
private _encounteredSettings = new Map<string, ISetting>(); // setting ID to setting
25-
private _featuredSettings = new Map<string, any>(); // setting ID to feature value
25+
private _featuredSettings = new Map<string, unknown>(); // setting ID to feature value
2626

2727
constructor(
2828
@IConfigurationService private readonly _configurationService: IConfigurationService,
@@ -87,7 +87,7 @@ export class SimpleSettingRenderer {
8787
};
8888
}
8989

90-
settingToUriString(settingId: string, value?: any): string {
90+
settingToUriString(settingId: string, value?: unknown): string {
9191
return `${Schemas.codeSetting}://${settingId}${value ? `/${value}` : ''}`;
9292
}
9393

@@ -208,7 +208,7 @@ export class SimpleSettingRenderer {
208208
return this._configurationService.updateValue(settingId, userOriginalSettingValue, ConfigurationTarget.USER);
209209
}
210210

211-
async setSetting(settingId: string, currentSettingValue: any, newSettingValue: any): Promise<void> {
211+
async setSetting(settingId: string, currentSettingValue: unknown, newSettingValue: unknown): Promise<void> {
212212
this._updatedSettings.set(settingId, currentSettingValue);
213213
return this._configurationService.updateValue(settingId, newSettingValue, ConfigurationTarget.USER);
214214
}

src/vs/workbench/contrib/testing/common/testItemCollection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const diffableProps: { [K in keyof ITestItem]?: (a: ITestItem[K], b: ITestItem[K
129129
},
130130
};
131131

132-
const diffableEntries = Object.entries(diffableProps) as readonly [keyof ITestItem, (a: any, b: any) => boolean][];
132+
const diffableEntries = Object.entries(diffableProps) as readonly [keyof ITestItem, (a: unknown, b: unknown) => boolean][];
133133

134134
const diffTestItems = (a: ITestItem, b: ITestItem) => {
135135
let output: Record<string, unknown> | undefined;

src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ export class GettingStartedPage extends EditorPane {
13191319
const commandURI = URI.parse(command);
13201320

13211321
// execute as command
1322-
let args: any = [];
1322+
let args = [];
13231323
try {
13241324
args = parse(decodeURIComponent(commandURI.query));
13251325
} catch {
@@ -1355,8 +1355,8 @@ export class GettingStartedPage extends EditorPane {
13551355
}
13561356
}
13571357

1358-
this.commandService.executeCommand<any>(commandURI.path, ...args).then(result => {
1359-
const toOpen: URI = result?.openFolder;
1358+
this.commandService.executeCommand(commandURI.path, ...args).then(result => {
1359+
const toOpen = (result as { openFolder?: URI })?.openFolder;
13601360
if (toOpen) {
13611361
if (!URI.isUri(toOpen)) {
13621362
console.warn('Warn: Running walkthrough command', href, 'yielded non-URI `openFolder` result', toOpen, '. It will be disregarded.');

0 commit comments

Comments
 (0)