I'm new to TS. I'm getting no error with this code:
interface Props {
active: boolean
error: any // unknown
input: any // unknown
onActivate: Function
onKeyUp: Function
onSelect: Function
onUpdate: Function
readonly: boolean
selected: boolean
value: string
}
However here, I get an error that reads:
Cannot redeclare block-scoped variable 'Function'.ts(2451)
for each and every declaration of Function
:
const EditableCell: React.FC<Props> = (props) => {
const {
input: any,
value: string,
selected: Function,
active: boolean
onSelect: Function,
onActivate: Function,
onUpdate: Function
} = props
BTW, these two code blocks immediately follow one another
Remove type assignments while destructuring props.
const {
active,
error, // unknown
input, // unknown
onActivate,
onKeyUp,
onSelect,
onUpdate,
readonly,
selected,
value
} = props