Is there any way to make properties inside PaginationProps required when enablePagination is true?
Is this possible?
interface PaginationProps {
total?: number;
offset?: number;
limit?: number;
}
interface Props<T> extends PaginationProps {
data: T;
enablePagination: boolean;
}
>Solution :
I wish I could answer this. Maybe I’ll attempt it (but not right this moment).
I think you need to use the Required utility type in conjunction with conditional types.