is there any way to achieve method parameter destructuring, but also be able to get method parameter.
In the context of a React application with stateless components, I'd like to be able to replace
const MyComponent = (props) => {
const {prop1, prop2} = props;
return (
<div className={prop1 + '-' + prop2}>
<Child {...props}/>
</div>
)
}
with a more concise syntax like
const MyComponent = (props: {prop1, prop2}) (
<div className={prop1 + '-' + prop2}>
<Child {...props}/>
</div>
)
Is there any syntax like that available?