What type is a variable declared as below. In what case is it useful?
let x: {}
In the following type alias what is the meaning of {}. Is it equivalent to object or any? Why you would want to use {} as type instead of any? Does {}, in this case mean "instance" of empty object? (does make sense to me)
type MessageHandler<D, P> = (data: D, payload: P) => void
type MessageHandlerGeneric = MessageHandler<{}, any}
interface MessageHandlers {
[index: string]: MessageHandlerGeneric
}
let handlers = MessageHandlers = {
handler1: (data: string, payload: Pyaload),
handler2: (data: Array<string>, payload: Payload)
}