Fix a bunch of strict issues (#11857)

* fix a bunch of strict issues

* fix tests

* fix tests
This commit is contained in:
Anthony Dresser
2020-08-19 10:37:30 -07:00
committed by GitHub
parent e90341b3d2
commit 60c62c0668
20 changed files with 100 additions and 79 deletions

View File

@@ -68,7 +68,9 @@ export class SelectBox extends vsSelectBox {
let optionItems: SelectOptionItemSQL[] = SelectBox.createOptions(options);
super(optionItems, 0, contextViewProvider, undefined, selectBoxOptions);
this._optionsDictionary = new Map<string, number>();
this.populateOptionsDictionary(optionItems);
this._dialogOptions = optionItems;
const option = this._optionsDictionary.get(selectedOption);
if (option) {
super.select(option);
@@ -144,7 +146,7 @@ export class SelectBox extends vsSelectBox {
}
public populateOptionsDictionary(options: SelectOptionItemSQL[]) {
this._optionsDictionary = new Map<string, number>();
this._optionsDictionary.clear();
for (let i = 0; i < options.length; i++) {
this._optionsDictionary.set(options[i].value, i);
}
@@ -198,7 +200,7 @@ export class SelectBox extends vsSelectBox {
}
public get label(): string | undefined {
return this._dialogOptions.find(s => s.value === this._selectedOption).text;
return this._dialogOptions?.find(s => s.value === this._selectedOption)?.text;
}
public get values(): string[] {