I've come across this particular syntax in a few Typescript libraries and I am trying to grasp its meaning.
error?: (error: T) => void
I have seen it being used like so:
class SomeClass {
someFunction(error?: (error: T) => void){
}
}
I understand that error?
signifies an optional error parameter, but I'm unsure about the :(error: T) =>void
part. Normally, you would declare the parameter type immediately after the :
.
Thank you
S