Преглед на файлове

Removes some `as any` usages

main
Eric Amodio преди 6 години
родител
ревизия
969ba41133
променени са 6 файла, в които са добавени 12 реда и са изтрити 12 реда
  1. +3
    -3
      src/commands/common.ts
  2. +1
    -1
      src/system/array.ts
  3. +5
    -5
      src/trackers/activeEditorTracker.ts
  4. +1
    -1
      src/views/gitExplorer.ts
  5. +1
    -1
      src/views/historyExplorer.ts
  6. +1
    -1
      src/views/resultsExplorer.ts

+ 3
- 3
src/commands/common.ts Целия файл

@ -134,11 +134,11 @@ export interface CommandViewContext extends CommandBaseContext {
}
export function isCommandViewContextWithBranch(context: CommandContext): context is CommandViewContext & { node: (ExplorerNode & { branch: GitBranch }) } {
return context.type === 'view' && (context.node as any).branch && (context.node as any).branch instanceof GitBranch;
return context.type === 'view' && (context.node as (ExplorerNode & { branch?: GitBranch })).branch instanceof GitBranch;
}
export function isCommandViewContextWithCommit<T extends GitCommit>(context: CommandContext): context is CommandViewContext & { node: (ExplorerNode & { commit: T }) } {
return context.type === 'view' && (context.node as any).commit && (context.node as any).commit instanceof GitCommit;
return context.type === 'view' && (context.node as (ExplorerNode & { commit?: GitCommit })).commit instanceof GitCommit;
}
export function isCommandViewContextWithRef(context: CommandContext): context is CommandViewContext & { node: (ExplorerNode & { ref: string }) } {
@ -146,7 +146,7 @@ export function isCommandViewContextWithRef(context: CommandContext): context is
}
export function isCommandViewContextWithRemote(context: CommandContext): context is CommandViewContext & { node: (ExplorerNode & { remote: GitRemote }) } {
return context.type === 'view' && (context.node as any).remote && (context.node as any).remote instanceof GitRemote;
return context.type === 'view' && (context.node as (ExplorerNode & { remote?: GitRemote })).remote instanceof GitRemote;
}
export type CommandContext = CommandScmGroupsContext | CommandScmStatesContext | CommandUnknownContext | CommandUriContext | CommandViewContext;

+ 1
- 1
src/system/array.ts Целия файл

@ -18,7 +18,7 @@ export namespace Arrays {
accumulator.push(mapped);
}
return accumulator;
}, [] as any);
}, [] as TMapped[]);
}
export async function filterMapAsync<T, TMapped>(source: T[], predicateMapper: (item: T) => Promise<TMapped | null | undefined>): Promise<TMapped[]> {

+ 5
- 5
src/trackers/activeEditorTracker.ts Целия файл

@ -40,20 +40,20 @@ export class ActiveEditorTracker extends Disposable {
async wait(timeout: number = 500): Promise<TextEditor | undefined> {
const editor = await new Promise<TextEditor>((resolve, reject) => {
let timer: any;
let timer: NodeJS.Timer | undefined;
this._resolver = (editor: TextEditor | undefined) => {
if (timer) {
clearTimeout(timer as any);
timer = 0;
clearTimeout(timer);
timer = undefined;
resolve(editor);
}
};
timer = setTimeout(() => {
resolve(window.activeTextEditor);
timer = 0;
}, timeout) as any;
timer = undefined;
}, timeout);
});
this._resolver = undefined;

+ 1
- 1
src/views/gitExplorer.ts Целия файл

@ -212,7 +212,7 @@ export class GitExplorer extends Disposable implements TreeDataProvider
}
refreshNode(node: ExplorerNode, args?: RefreshNodeCommandArgs) {
Logger.log(`GitExplorer[view=${this.view}].refreshNode(${(node as any).id})`);
Logger.log(`GitExplorer[view=${this.view}].refreshNode(${(node as { id?: string}).id || ''})`);
if (args !== undefined && node.supportsPaging) {
node.maxCount = args.maxCount;

+ 1
- 1
src/views/historyExplorer.ts Целия файл

@ -148,7 +148,7 @@ export class HistoryExplorer extends Disposable implements TreeDataProvider
}
refreshNode(node: ExplorerNode, args?: RefreshNodeCommandArgs) {
Logger.log(`HistoryExplorer.refreshNode(${(node as any).id})`);
Logger.log(`HistoryExplorer.refreshNode(${(node as { id?: string}).id || ''})`);
if (args !== undefined && node.supportsPaging) {
node.maxCount = args.maxCount;

+ 1
- 1
src/views/resultsExplorer.ts Целия файл

@ -123,7 +123,7 @@ export class ResultsExplorer extends Disposable implements TreeDataProvider
}
refreshNode(node: ExplorerNode, args?: RefreshNodeCommandArgs) {
Logger.log(`ResultsExplorer.refreshNode(${(node as any).id})`);
Logger.log(`ResultsExplorer.refreshNode(${(node as { id?: string}).id || ''})`);
if (args !== undefined && node.supportsPaging) {
node.maxCount = args.maxCount;

Зареждане…
Отказ
Запис