Yo, everybody! I'm just curious of how I got this to work but I really don't know why it works. Can any one give some techinical explanation?
import { createContext } from 'react'
interface IContext {
state: any
dispatch: any
}
export interface ITodoProps {
todos: [{ id: number; title: string }]
}
export const TodoContext = createContext<IContext>({} as IContext)
If I don't type my empty object with as IContext, Typescript gets REALLY mad at me and I don't know why. Is there some thechinical reason for the particular behaviuour?