SCM - remove the usage of any (#272231)

This commit is contained in:
Ladislau Szomoru
2025-10-20 11:47:06 +02:00
committed by GitHub
parent 02ebbd647d
commit b63cdda669
5 changed files with 18 additions and 22 deletions

View File

@@ -731,10 +731,6 @@ export default tseslint.config(
'src/vs/workbench/contrib/preferences/browser/settingsTree.ts',
'src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts',
'src/vs/workbench/contrib/remote/browser/tunnelView.ts',
'src/vs/workbench/contrib/scm/browser/quickDiffWidget.ts',
'src/vs/workbench/contrib/scm/browser/scmRepositoriesViewPane.ts',
'src/vs/workbench/contrib/scm/browser/scmViewPane.ts',
'src/vs/workbench/contrib/scm/browser/util.ts',
'src/vs/workbench/contrib/search/browser/AISearch/aiSearchModel.ts',
'src/vs/workbench/contrib/search/browser/AISearch/aiSearchModelBase.ts',
'src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchModel.ts',

View File

@@ -108,7 +108,7 @@ export class QuickDiffPickerBaseAction extends Action {
class QuickDiffWidgetActionRunner extends ActionRunner {
protected override runAction(action: IAction, context: any): Promise<any> {
protected override runAction(action: IAction, context: unknown[]): Promise<void> {
if (action instanceof MenuItemAction) {
return action.run(...context);
}
@@ -140,7 +140,7 @@ class QuickDiffWidgetEditorAction extends Action {
this.editor = editor;
}
override run(): Promise<any> {
override run(): Promise<void> {
return Promise.resolve(this.instantiationService.invokeFunction(accessor => this.action.run(accessor, this.editor, null)));
}
}

View File

@@ -79,7 +79,7 @@ class RepositoryTreeIdentityProvider implements IIdentityProvider<ISCMRepository
export class SCMRepositoriesViewPane extends ViewPane {
private tree!: WorkbenchCompressibleAsyncDataTree<ISCMViewService, ISCMRepository, any>;
private tree!: WorkbenchCompressibleAsyncDataTree<ISCMViewService, ISCMRepository>;
private treeDataSource!: RepositoryTreeDataSource;
private treeIdentityProvider!: RepositoryTreeIdentityProvider;
private readonly treeOperationSequencer = new Sequencer();
@@ -229,7 +229,7 @@ export class SCMRepositoriesViewPane extends ViewPane {
}
}
}
) as WorkbenchCompressibleAsyncDataTree<ISCMViewService, ISCMRepository, any>;
) as WorkbenchCompressibleAsyncDataTree<ISCMViewService, ISCMRepository>;
this._register(this.tree);
this._register(autorun(reader => {

View File

@@ -515,7 +515,7 @@ class RepositoryPaneActionRunner extends ActionRunner {
super();
}
protected override async runAction(action: IAction, context: ISCMResourceGroup | ISCMResource | IResourceNode<ISCMResource, ISCMResourceGroup>): Promise<any> {
protected override async runAction(action: IAction, context: ISCMResourceGroup | ISCMResource | IResourceNode<ISCMResource, ISCMResourceGroup>): Promise<void> {
if (!(action instanceof MenuItemAction)) {
return super.runAction(action, context);
}
@@ -1694,7 +1694,7 @@ class SCMInputWidget {
}
// Validation
const validationDelayer = new ThrottledDelayer<any>(200);
const validationDelayer = new ThrottledDelayer<void>(200);
const validate = async () => {
const position = this.inputEditor.getSelection()?.getStartPosition();
const offset = position && textModel.getOffsetAt(position);
@@ -2612,7 +2612,7 @@ export class SCMViewPane extends ViewPane {
}
const element = e.element;
let context: any = element;
let context: unknown = element;
let actions: IAction[] = [];
const disposables = new DisposableStore();

View File

@@ -21,47 +21,47 @@ import { IResourceNode, ResourceTree } from '../../../../base/common/resourceTre
import { ThemeIcon } from '../../../../base/common/themables.js';
import { Codicon } from '../../../../base/common/codicons.js';
export function isSCMViewService(element: any): element is ISCMViewService {
export function isSCMViewService(element: unknown): element is ISCMViewService {
return Array.isArray((element as ISCMViewService).repositories) && Array.isArray((element as ISCMViewService).visibleRepositories);
}
export function isSCMRepository(element: any): element is ISCMRepository {
export function isSCMRepository(element: unknown): element is ISCMRepository {
return !!(element as ISCMRepository).provider && !!(element as ISCMRepository).input;
}
export function isSCMInput(element: any): element is ISCMInput {
export function isSCMInput(element: unknown): element is ISCMInput {
return !!(element as ISCMInput).validateInput && typeof (element as ISCMInput).value === 'string';
}
export function isSCMActionButton(element: any): element is ISCMActionButton {
export function isSCMActionButton(element: unknown): element is ISCMActionButton {
return (element as ISCMActionButton).type === 'actionButton';
}
export function isSCMResourceGroup(element: any): element is ISCMResourceGroup {
export function isSCMResourceGroup(element: unknown): element is ISCMResourceGroup {
return !!(element as ISCMResourceGroup).provider && !!(element as ISCMResourceGroup).resources;
}
export function isSCMResource(element: any): element is ISCMResource {
export function isSCMResource(element: unknown): element is ISCMResource {
return !!(element as ISCMResource).sourceUri && isSCMResourceGroup((element as ISCMResource).resourceGroup);
}
export function isSCMResourceNode(element: any): element is IResourceNode<ISCMResource, ISCMResourceGroup> {
export function isSCMResourceNode(element: unknown): element is IResourceNode<ISCMResource, ISCMResourceGroup> {
return ResourceTree.isResourceNode(element) && isSCMResourceGroup(element.context);
}
export function isSCMHistoryItemViewModelTreeElement(element: any): element is SCMHistoryItemViewModelTreeElement {
export function isSCMHistoryItemViewModelTreeElement(element: unknown): element is SCMHistoryItemViewModelTreeElement {
return (element as SCMHistoryItemViewModelTreeElement).type === 'historyItemViewModel';
}
export function isSCMHistoryItemLoadMoreTreeElement(element: any): element is SCMHistoryItemLoadMoreTreeElement {
export function isSCMHistoryItemLoadMoreTreeElement(element: unknown): element is SCMHistoryItemLoadMoreTreeElement {
return (element as SCMHistoryItemLoadMoreTreeElement).type === 'historyItemLoadMore';
}
export function isSCMHistoryItemChangeViewModelTreeElement(element: any): element is SCMHistoryItemChangeViewModelTreeElement {
export function isSCMHistoryItemChangeViewModelTreeElement(element: unknown): element is SCMHistoryItemChangeViewModelTreeElement {
return (element as SCMHistoryItemChangeViewModelTreeElement).type === 'historyItemChangeViewModel';
}
export function isSCMHistoryItemChangeNode(element: any): element is IResourceNode<ISCMHistoryItem, SCMHistoryItemChangeViewModelTreeElement> {
export function isSCMHistoryItemChangeNode(element: unknown): element is IResourceNode<ISCMHistoryItem, SCMHistoryItemChangeViewModelTreeElement> {
return ResourceTree.isResourceNode(element) && isSCMHistoryItemViewModelTreeElement(element.context);
}