In the @types/React package of the DefinitelyTyped library, I came across this definition:
interface FunctionComponent<P = {}> {
(props: PropsWithChildren<P>, context?: any): ReactElement | null;
propTypes?: WeakValidationMap<P>;
contextTypes?: ValidationMap<any>;
defaultProps?: Partial<P>;
displayName?: string;
}
I learned that the default type for P is {}, known as the Empty Object type which describes an object with no properties. Does anyone know why it's commonly used as a default type for most generic functions?