Here I want to define the type for object value only. In order to get types for keys. Is there any way to get without defining types for each value.
const sizes: Record<string, CSSObject>= {
md: {
padding: [10, 24],
fontSize: 'medium',
},
xs: {
padding: [6, 12],
fontSize: 'small',
},
sm: {
padding: [8, 16],
fontSize: 'small',
},
lg: {
padding: [14, 30],
fontSize: 'large',
},
} as const;
// Expecting 'md' | 'xs' | 'sm' | 'lg'
type Sizes = keyof typeof sizes;
// But it is string
const sizes: { [K in keyof typeof sizes]: CSSObject } = {...yup kind of this but it's not working, it says Type parameter 'K' has a circular constraint.