Type assertion for undefined variable inside children component React TypeScript – Reactjs
I have the following code: <Show when={!!icon} fallback={<SVG src={defaultIcon}/>}> <SVG src={icon!} className={styles.buttonIcon} /> </Show> Because icon can be undefined, I created a wrapper to wrap SVG component with, but typescript still thinks that icon can be undefined even if the…