mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-20 02:08:47 +00:00
Git - more any cleanup (#277190)
This commit is contained in:
@@ -365,7 +365,6 @@ export default tseslint.config(
|
||||
'extensions/git/src/commands.ts',
|
||||
'extensions/git/src/decorators.ts',
|
||||
'extensions/git/src/git.ts',
|
||||
'extensions/git/src/repository.ts',
|
||||
'extensions/git/src/util.ts',
|
||||
'extensions/git-base/src/decorators.ts',
|
||||
'extensions/github/src/util.ts',
|
||||
|
||||
@@ -186,7 +186,7 @@ export class Resource implements SourceControlResourceState {
|
||||
get renameResourceUri(): Uri | undefined { return this._renameResourceUri; }
|
||||
get contextValue(): string | undefined { return this._repositoryKind; }
|
||||
|
||||
private static Icons: any = {
|
||||
private static Icons = {
|
||||
light: {
|
||||
Modified: getIconUri('status-modified', 'light'),
|
||||
Added: getIconUri('status-added', 'light'),
|
||||
@@ -211,7 +211,7 @@ export class Resource implements SourceControlResourceState {
|
||||
}
|
||||
};
|
||||
|
||||
private getIconPath(theme: string): Uri {
|
||||
private getIconPath(theme: 'light' | 'dark'): Uri {
|
||||
switch (this.type) {
|
||||
case Status.INDEX_MODIFIED: return Resource.Icons[theme].Modified;
|
||||
case Status.MODIFIED: return Resource.Icons[theme].Modified;
|
||||
@@ -720,7 +720,9 @@ export class Repository implements Disposable {
|
||||
|
||||
@memoize
|
||||
get onDidChangeOperations(): Event<void> {
|
||||
return anyEvent(this.onRunOperation as Event<any>, this.onDidRunOperation as Event<any>);
|
||||
return anyEvent(
|
||||
this.onRunOperation as Event<unknown>,
|
||||
this.onDidRunOperation as Event<unknown>) as Event<void>;
|
||||
}
|
||||
|
||||
private _sourceControl: SourceControl;
|
||||
@@ -2324,14 +2326,15 @@ export class Repository implements Disposable {
|
||||
|
||||
private async run<T>(
|
||||
operation: Operation,
|
||||
runOperation: () => Promise<T> = () => Promise.resolve<any>(null),
|
||||
getOptimisticResourceGroups: () => GitResourceGroups | undefined = () => undefined): Promise<T> {
|
||||
runOperation: () => Promise<T> = () => Promise.resolve(null) as Promise<T>,
|
||||
getOptimisticResourceGroups: () => GitResourceGroups | undefined = () => undefined
|
||||
): Promise<T> {
|
||||
|
||||
if (this.state !== RepositoryState.Idle) {
|
||||
throw new Error('Repository not initialized');
|
||||
}
|
||||
|
||||
let error: any = null;
|
||||
let error: unknown = null;
|
||||
|
||||
this._operations.start(operation);
|
||||
this._onRunOperation.fire(operation.kind);
|
||||
@@ -2347,7 +2350,7 @@ export class Repository implements Disposable {
|
||||
} catch (err) {
|
||||
error = err;
|
||||
|
||||
if (err.gitErrorCode === GitErrorCodes.NotAGitRepository) {
|
||||
if (err instanceof GitError && err.gitErrorCode === GitErrorCodes.NotAGitRepository) {
|
||||
this.state = RepositoryState.Disposed;
|
||||
}
|
||||
|
||||
@@ -2362,7 +2365,7 @@ export class Repository implements Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
private async retryRun<T>(operation: Operation, runOperation: () => Promise<T> = () => Promise.resolve<any>(null)): Promise<T> {
|
||||
private async retryRun<T>(operation: Operation, runOperation: () => Promise<T>): Promise<T> {
|
||||
let attempt = 0;
|
||||
|
||||
while (true) {
|
||||
|
||||
Reference in New Issue
Block a user