ComponentPropsWithoutRef is a React utility type that derives a component’s props while excluding ref. This matches components that receive ref through a separate mechanism rather than as an ordinary prop, especially before React 19. section 5.3.4 section 5.4
A typed BookReview wrapper
type RatingProps = ComponentPropsWithoutRef<typeof Rating>;\ntype PickedRatingProps = Pick<RatingProps, "value" | "max" | "icon">;\ninterface BookReviewProps extends PickedRatingProps {\n title: string;\n reviewer: string;\n body: string;\n}\n\nfunction BookReview({ title, reviewer, body, ...rest }: BookReviewProps) {\n return (\n <section className="review">\n <Rating max={5} {...rest} />\n <h3>{title}</h3>\n <h4>By {reviewer}</h4>\n <p>{body}</p>\n </section>\n );\n}\n\n<BookReview title="Great book" reviewer="Anonymous" body="I loved the book" value={4.8} />
