QuizNot attempted
Polymorphic 'as' prop
1–4 to choose, Enter to submit
Show answer & explanation
Correct answers:
- (2)
- (3)
Eis inferred fromas, thenComponentProps<E>supplies exactly that element's props: (2) fails because'p1'is not a key ofJSX.IntrinsicElements(so it breaks theE extends ElementTypeconstraint), and (3) fails becausehrefis not alabelprop.- Not (1):
htmlForis a validlabelprop. - Not (4):
hrefis an anchor prop andsizecomes from the own props, whichOmitkeeps from clashing with any nativesize.