Could someone help me with this code snippet?
export const getColor = (color: string): string => colors[color] || colors.white;
I'm encountering a warning line under colors[color] || colors.white
stating that it is an "Unsafe return of an any typed value". I have verified that this method accepts a string and returns a string, but I am unsure of the exact issue since the use of any
is prohibited in this case.
export const colors = {
'dark-grey': '#606060',
'light-grey': '#909090',
'slate-grey': '#7889a0',
'olive-green': '#8fd683',
'light-blue': '#0371ff',
'dark-gray': '#4b6c89',
'blue-700-new': 'var(--color-brand-primary-default-new)',
azure: '#1676ff',
blue: '#1676ff',
white: '#fff',
black: '#000',
brandPrimaryDefault: 'var(--color-brand-primary-default-new)',
brandPrimaryLight: 'var(--color-brand-primary-light-new)',
naturalGrayDarker2: 'var(--color-natural-gray-darker-2)',
};