24:14 To those who got confused, so what basically happened here is that I did not set the generic `Props` to the argument of the useAccordionCondi instead I directly put the `AccordionProps` in the argument. Wrong Code: export function useAccordionCondi( props: AccordionProps // wrong! ) { return ( props.allowMultiple === true ? { allowMultiple: true, returns: ["string"] } : { allowMultiple: false, returns: "string" } ) as Value; } Good Code: export function useAccordionCondi(props: T /* passing T in here */) { return ( props.allowMultiple === true ? { allowMultiple: true, returns: ["string"] } : { allowMultiple: false, returns: "string" } ) as Value; }
Thanks Santosh and Anurag for these awesome content, was completely hooked till the end 😄
Thank you so much 😀
hey guys you nailed typescript today. extremely good content
Thank you @Rohit Chopra
24:14 To those who got confused, so what basically happened here is that I did not set the generic `Props` to the argument of the useAccordionCondi instead I directly put the `AccordionProps` in the argument.
Wrong Code:
export function useAccordionCondi(
props: AccordionProps // wrong!
) {
return (
props.allowMultiple === true
? { allowMultiple: true, returns: ["string"] }
: { allowMultiple: false, returns: "string" }
) as Value;
}
Good Code:
export function useAccordionCondi(props: T /* passing T in here */) {
return (
props.allowMultiple === true
? { allowMultiple: true, returns: ["string"] }
: { allowMultiple: false, returns: "string" }
) as Value;
}