Fix body count
This commit is contained in:
parent
20c956e0d6
commit
6c3382f2ae
|
@ -80,18 +80,22 @@ export function validateHbsTemplate(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const providedParams = node.params
|
let providedParamsCount = node.params.length
|
||||||
|
if (isBlockStatement(node)) {
|
||||||
|
// Block body counts as a parameter
|
||||||
|
providedParamsCount++
|
||||||
|
}
|
||||||
|
|
||||||
if (providedParams.length !== expectedArguments.length) {
|
if (providedParamsCount !== expectedArguments.length) {
|
||||||
diagnostics.push({
|
diagnostics.push({
|
||||||
from,
|
from,
|
||||||
to,
|
to,
|
||||||
severity: "error",
|
severity: "error",
|
||||||
message: `Helper "${helperName}" expects ${
|
message: `Helper "${helperName}" expects ${
|
||||||
expectedArguments.length
|
expectedArguments.length
|
||||||
} parameters (${expectedArguments.join(", ")}), but got ${
|
} parameters (${expectedArguments.join(
|
||||||
providedParams.length
|
", "
|
||||||
}.`,
|
)}), but got ${providedParamsCount}.`,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue