GX4004: signal type does not match the action field
An action input field and the signal that it reads have different types.
Cause
An action input field and the signal that it reads have different types.
Example
package cart
import "app/cart/route"
signals {
Qty string = "1"
}
<button on:click={route.Add{}}>Add</button>package cart
import (
"github.com/alternayte/gx"
"app/cart/route"
)
var Add = gx.Action(func(c *gx.Ctx, in route.Add) error { return nil })package route
import "github.com/alternayte/gx"
type Add struct {
gx.Route `POST /cart/add`
Qty int `signal:"qty"`
}
func (in *Add) Rules() gx.Rules {
return gx.Rules{gx.Field(&in.Qty, gx.Min(1))}
}gx check reports:
cart/Button.gx:9:9: GX4004: field "Qty" has type "int" but signal "qty" has type "string"Fix
Give the field and the signal the same type.