Having some trouble defining the array type: The code below is functioning perfectly:
const messageCustomStyles: Array<keyof IAlertMessage> = [
'font',
'margin',
'padding'
];
return getCustomStylesFrom(styles, 'message', messageCustomStyles);
I am trying to move this array into a function argument with its type, like this:
return getCustomStylesFrom(
styles,
'message',
['font', 'margin', 'padding']: Array<keyof IAlertMessage>);
However, I'm getting a TypeScript error saying 'Expected 3 arguments, but got 4.' It seems like it's treating the type after ':' as a new parameter.
Any suggestions on how to resolve this issue?