TS throws an error that states:
Error:(8, 20) TS7031: Binding element 'on' implicitly has an 'any' type.
Error:(8, 24) TS7031: Binding element 'children' implicitly has an 'any' type.
Below is the function I am working with. It takes in two arguments.
//
function On({on, children}) {
return (
<div>{on} {children}</div>
)
}
I am trying to specify types for the arguments in this scenario. However, the usual syntax does not seem to work:
function On({(on as boolean), (children as HTMLElement[])}) {
function On({(on: boolean), (children: HTMLElement[])}) {
function On({on: boolean, children: HTMLElement[]}) {
return (
<div>{on} {children}</div>
)
}