strict compile for sql/workbench/contrib/queryHistory (#12579)

This commit is contained in:
Charles Gagnon
2020-09-23 10:36:00 -07:00
committed by GitHub
parent f8eb203643
commit 4a089131fc
4 changed files with 13 additions and 16 deletions

View File

@@ -19,7 +19,7 @@ export class QueryHistoryDataSource implements IDataSource {
if (element instanceof QueryHistoryNode && element.info) {
return element.info.id;
}
return undefined;
return '';
}
/**

View File

@@ -15,5 +15,5 @@ export class QueryHistoryNode {
public children: QueryHistoryNode[] = [];
constructor(
public info: QueryHistoryInfo) { }
public info: QueryHistoryInfo | undefined) { }
}

View File

@@ -42,7 +42,7 @@ export class QueryHistoryRenderer implements IRenderer {
* Returns a template ID for a given element.
*/
public getTemplateId(tree: ITree, element: QueryHistoryNode): string {
return element.info.id;
return element.info?.id || '';
}
/**
@@ -63,7 +63,7 @@ export class QueryHistoryRenderer implements IRenderer {
* Render a element, given an object bag returned by the template
*/
public renderElement(tree: ITree, element: QueryHistoryNode, templateId: string, templateData: IQueryHistoryItemTemplateData): void {
let taskStatus;
let taskStatus = '';
if (element && element.info) {
templateData.icon.className = 'query-history-icon';
if (element.info.status === QueryStatus.Succeeded) {

View File

@@ -34,8 +34,8 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
* QueryHistoryView implements the dynamic tree view for displaying Query History
*/
export class QueryHistoryView extends ViewPane {
private _messages: HTMLElement;
private _tree: ITree;
private _messages!: HTMLElement;
private _tree!: ITree;
private _actionProvider: QueryHistoryActionProvider;
constructor(
@@ -87,11 +87,10 @@ export class QueryHistoryView extends ViewPane {
const controller = instantiationService.createInstance(QueryHistoryController, this._actionProvider);
const dnd = new DefaultDragAndDrop();
const filter = new DefaultFilter();
const sorter = null;
const accessibilityProvider = new DefaultAccessibilityProvider();
return new Tree(treeContainer, {
dataSource, renderer, controller, dnd, filter, sorter, accessibilityProvider
dataSource, renderer, controller, dnd, filter, sorter: undefined, accessibilityProvider
}, {
indentPixels: 10,
twistiePixels: 20,
@@ -103,15 +102,13 @@ export class QueryHistoryView extends ViewPane {
let selectedElement: any;
let targetsToExpand: any[];
if (this._tree) {
const selection = this._tree.getSelection();
if (selection && selection.length === 1) {
selectedElement = <any>selection[0];
}
// convert to old VS Code tree interface with expandable methods
const expandableTree: IExpandableTree = <IExpandableTree>this._tree;
targetsToExpand = expandableTree.getExpandedElements();
const selection = this._tree.getSelection();
if (selection && selection.length === 1) {
selectedElement = <any>selection[0];
}
// convert to old VS Code tree interface with expandable methods
const expandableTree: IExpandableTree = <IExpandableTree>this._tree;
targetsToExpand = expandableTree.getExpandedElements();
const nodes: QueryHistoryNode[] = this.queryHistoryService.getQueryHistoryInfos().map(i => new QueryHistoryNode(i));