How can I prevent multiple 'as const' needing by declaring an interface or a type to solve this issue below?
export const MESSAGES = {
WELlCOME_MESSAGE: 'Wellcome again' as const,
UNALLOWED_MESSAGE: 'You are not allowed' as const,
ALLOWED_MESSAGE: 'You are allowed' as const,
}
CodePudding user response:
Just declare as const
on the object level instead:
export const MESSAGES = {
WELlCOME_MESSAGE: 'Wellcome again',
UNALLOWED_MESSAGE: 'You are not allowed',
ALLOWED_MESSAGE: 'You are allowed',
} as const;