S022
trigger argument does not match the alert payload
Severity Error
An alert declared with payload: T must be triggered with exactly one value of type T; an alert without a payload is triggered with no argument. The call here passes the wrong number of values.
Match the declaration: add the payload record, remove the stray argument, or change the declaration.
Failing example
script "Funding extreme"
data funding = subscribe(data.funding)
type FundingHit {
rate: float
}
alert extreme = alert(title: "Extreme funding", payload: FundingHit)
on funding.close {
let r = funding.rate ?? 0.0
if math.abs(r) > 0.001 {
extreme.trigger()
}
}Fixed example
script "Funding extreme"
data funding = subscribe(data.funding)
type FundingHit {
rate: float
}
alert extreme = alert(title: "Extreme funding", payload: FundingHit)
on funding.close {
let r = funding.rate ?? 0.0
if math.abs(r) > 0.001 {
extreme.trigger(FundingHit { rate: r })
}
}