OK
Есть обьект с темами:
export const themes = {
themeDark: 'theme-dark',
themeLight: 'theme-light',
};Как сделать чтобы функция принимала только значения обьекта themes?
export const changeTheme = (theme: string) => {Size: a a a
OK
export const themes = {
themeDark: 'theme-dark',
themeLight: 'theme-light',
};export const changeTheme = (theme: string) => {AK
export const themes = {
themeDark: 'theme-dark' as const,
themeLight: 'theme-light' as const
};
type themeValues = typeof themes[keyof typeof themes];🦉

Property 'type' does not exist on type '{}'.VK
VK
DS
function isType(object: {string: any}, type: string)🦉
VK
🦉
function isType(object: {string: any}, type: string)AK

Property 'type' does not exist on type '{}'.VK
🦉
MK

Property 'type' does not exist on type '{}'.VK
OK

Property 'type' does not exist on type '{}'.АК
export const themes = {
themeDark: 'theme-dark' as const,
themeLight: 'theme-light' as const
};
type themeValues = typeof themes[keyof typeof themes];MK
🦉
‘type’ in objectАЗ

Property 'type' does not exist on type '{}'.AK