type ButtonProps = { type: "button" "submit" "reset" "filled"; }; const Container =…
- User
type ButtonProps = { type: "button" | "submit" | "reset" | "filled"; }; const Container = styled.div
; const Wrapper = styled.div` padding: 20px; `; const Title = styled.h2` font-weight: 300; text-align: center; `; const Top = styled.div` display: flex; justify-content: space-between; align-items: center; `; const TopButton = styled.button<ButtonProps>` padding: 10px; font-weight: 600; cursor: pointer; border: ${(props) => (props.type === "filled" ? "none" : null)}; `; const TopTexts = styled.div; const TopText = styled.spantext-decoration: underline; cursor: pointer; margin: 0 10px;; const Bottom = styled.div``; const Cart = () => { return ( YOUR CART CONTINUE SHOPPING Shopping Bag(2) Your Wishlist(0) CHECKOUT NOW ); };export default Cart; type ButtonProps = { type: "button" | "submit" | "reset" | "filled"; }; const Container = styled.div
; const Wrapper = styled.div` padding: 20px; `; const Title = styled.h2` font-weight: 300; text-align: center; `; const Top = styled.div` display: flex; justify-content: space-between; align-items: center; `; const TopButton = styled.button<ButtonProps>` padding: 10px; font-weight: 600; cursor: pointer; border: ${(props) => (props.type === "filled" ? "none" : null)}; `; const TopTexts = styled.div; const TopText = styled.spantext-decoration: underline; cursor: pointer; margin: 0 10px;; const Bottom = styled.div``; const Cart = () => { return ( YOUR CART CONTINUE SHOPPING Shopping Bag(2) Your Wishlist(0) CHECKOUT NOW ); };export default Cart; type ButtonProps = { type: "button" | "submit" | "reset" | "filled"; }; const Container = styled.div
; const Wrapper = styled.div` padding: 20px; `; const Title = styled.h2` font-weight: 300; text-align: center; `; const Top = styled.div` display: flex; justify-content: space-between; align-items: center; `; const TopButton = styled.button<ButtonProps>` padding: 10px; font-weight: 600; cursor: pointer; border: ${(props) => (props.type === "filled" ? "none" : null)}; `; const TopTexts = styled.div; const TopText = styled.spantext-decoration: underline; cursor: pointer; margin: 0 10px;; const Bottom = styled.div``; const Cart = () => { return ( YOUR CART CONTINUE SHOPPING Shopping Bag(2) Your Wishlist(0) CHECKOUT NOW ); };export default Cart; This comparison appears to be unintentional because the types '"button" | "submit" | "reset"' and '"filled"' have no overlap.ts(2367)
- Assistant
This error message is indicating a type mismatch between the
typeprop defined in theButtonPropstype and the value "filled" passed to it in theTopButtonstyled component. TheButtonPropstype restricts the possible values of thetypeprop to "button", "submit", or "reset", but "filled" is not one of those options.To fix this issue, you can either update the
typeprop options in theButtonPropstype to include "filled", or you can pass a different prop name to theTopButtoncomponent instead oftype. For example, you could change theButtonPropstype to:codetype ButtonProps = { type: "button" | "submit" | "reset" | "filled"; };Or you could change the
TopButtoncomponent to use a different prop name, likebuttonType:code