args validation

pull/10851/head
Simon Holthausen 2 years ago
parent 62c39ee851
commit 6ea89a3f7e

@ -1070,7 +1070,7 @@ export const validation_runes = merge(validation, a11y_validators, {
// TODO some of this is duplicated with above, seems off
if ((rune === '$derived' || rune === '$derived.by') && args.length !== 1) {
error(node, 'invalid-rune-args-length', rune, [1]);
} else if (rune === '$state' && args.length > 1) {
} else if ((rune === '$state' || rune === '$bindable') && args.length > 1) {
error(node, 'invalid-rune-args-length', rune, [0, 1]);
} else if (rune === '$props') {
if (state.has_props_rune) {

@ -0,0 +1,8 @@
import { test } from '../../test';
export default test({
error: {
code: 'invalid-rune-args-length',
message: '$bindable can only be called with 0 or 1 arguments'
}
});

@ -0,0 +1,3 @@
<script>
const { foo = $bindable(1, 2) } = $props();
</script>
Loading…
Cancel
Save