From db3dda85198d1e688e37faecd16e08e08b628673 Mon Sep 17 00:00:00 2001 From: Candice Ye Date: Tue, 19 Jul 2022 14:12:03 -0700 Subject: [PATCH] Got rid of need for casting (#20088) Co-authored-by: Candice Ye --- .../src/ui/radioGroupLoadingComponentBuilder.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/extensions/resource-deployment/src/ui/radioGroupLoadingComponentBuilder.ts b/extensions/resource-deployment/src/ui/radioGroupLoadingComponentBuilder.ts index 766ebf5d4f..444369762a 100644 --- a/extensions/resource-deployment/src/ui/radioGroupLoadingComponentBuilder.ts +++ b/extensions/resource-deployment/src/ui/radioGroupLoadingComponentBuilder.ts @@ -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 ((optionsInfo.defaultValue).displayName) { - defaultValue = (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')