Reputation: 7119
I'd like something like
interface propType {
value: T
action: (value: T) => void
}
Where T
is anything, but it has to be same for both value
and action
. Typing them as any
doesn't work because it would allow a type mismatch.
Upvotes: 0
Views: 28
Reputation:
You were almost there:
interface propType<T> {
value: T
action: (value: T) => void
}
Upvotes: 4