Being new to TS, I encountered an interesting issue. The first code snippet worked without any errors:
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, upon reaching the next section, an error popped up saying:
Cannot redeclare block-scoped variable 'Function'.ts(2451)
This was due to 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
Interestingly, these two snippets were right after each other.