Got rid of need for casting (#20088)

Co-authored-by: Candice Ye <canye@microsoft.com>
This commit is contained in:
Candice Ye
2022-07-19 14:12:03 -07:00
committed by GitHub
parent 709d15a392
commit db3dda8519

View File

@@ -46,12 +46,10 @@ export class RadioGroupLoadingComponentBuilder implements azdata.ComponentBuilde
let options: (string[] | azdata.CategoryValue[]) = optionsInfo.values!;
let defaultValue: string | ResourceTypeOptionValue = optionsInfo.defaultValue!;
if (optionsInfo.defaultValue) {
if ((<ResourceTypeOptionValue>optionsInfo.defaultValue).displayName) {
defaultValue = (<ResourceTypeOptionValue>optionsInfo.defaultValue).displayName;
} else {
defaultValue = optionsInfo.defaultValue;
}
if (typeof optionsInfo.defaultValue === 'string') {
defaultValue = optionsInfo.defaultValue;
} else {
defaultValue = optionsInfo.defaultValue.displayName;
}
options.forEach((op: string | azdata.CategoryValue) => {
const option: azdata.CategoryValue = (typeof op === 'string')