patterntypescriptreactCritical
Type for style attribute passed to function
Viewed 0 times
functionattributestyleforpassedtype
Problem
Please consider this typescript function
What is the correct type for the first argument
Sorry, I wasn't sufficiently clear. I want to know what type to use to replace the "any" in
I'm talking about definition of the function, not application.
function button(style: any, func: ()=>void, img: string) {
return (
Back
);
}What is the correct type for the first argument
style? I feel like it should be something like HTMLElementStyle but I can't find the right incantation. Sorry, I wasn't sufficiently clear. I want to know what type to use to replace the "any" in
style: any. The typescript definitions handle checking the types of the supplied members of the object.I'm talking about definition of the function, not application.
Solution
The type is
React.CSSProperties. You can find this in VSCode by writing ` and pressing F12 when having your cursor in the style` attribute.Context
Stack Overflow Q#45019775, score: 341
Revisions (0)
No revisions yet.