GX2004: static value for a typed prop
A static string is given to a prop that has a type other than string.
Cause
A static string is given to a prop that has a type other than string. Gx does not change a string into a constant.
Example
package card
props {
Title string
Variant Variant = Plain
}
<article data-variant={string(p.Variant)}>{p.Title}</article>package card
<Card title="News" variant="raised" />package card
// Variant is the visual style of a card.
type Variant string
const (
Plain Variant = "plain"
Raised Variant = "raised"
)gx check reports:
ui/card/Page.gx:3:20: GX2004: attribute "variant" is a static string but prop "Variant" has type "Variant"Fix
Pass the constant as an expression, for example variant={card.Raised}.