Skip to content

Commit c6dc740

Browse files
committed
feat: do nothing instead of warning when binding a non-existent prop
1 parent 351b3e7 commit c6dc740

File tree

5 files changed

+2
-26
lines changed

5 files changed

+2
-26
lines changed

.changeset/nervous-pans-call.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
'svelte': patch
33
---
44

5-
fix: warn instead of error when binding a non-existent prop
5+
fix: do not error when binding a non-existent prop

packages/svelte/messages/client-warnings/warnings.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
## binding_non_existent_prop
2-
3-
> A component is attempting to bind to a non-existent property `%key%` belonging to %component% (i.e. `<%name% bind:%key%={...}>`)
4-
51
## binding_property_non_reactive
62

73
> `%binding%` is binding to a non-reactive property

packages/svelte/src/internal/client/validate.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ export function validate_prop_bindings(
7575
if (has_rest || non_bindable.includes(key)) {
7676
e.bind_not_bindable(key, component[FILENAME], name);
7777
}
78-
w.binding_non_existent_prop(key, component[FILENAME], name);
7978
}
8079
}
8180
}

packages/svelte/src/internal/client/warnings.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,6 @@ import { DEV } from 'esm-env';
55
var bold = 'font-weight: bold';
66
var normal = 'font-weight: normal';
77

8-
/**
9-
* A component is attempting to bind to a non-existent property `%key%` belonging to %component% (i.e. `<%name% bind:%key%={...}>`)
10-
* @param {string} key
11-
* @param {string} component
12-
* @param {string} name
13-
*/
14-
export function binding_non_existent_prop(key, component, name) {
15-
if (DEV) {
16-
console.warn(`%c[svelte] binding_non_existent_prop\n%cA component is attempting to bind to a non-existent property \`${key}\` belonging to ${component} (i.e. \`<${name} bind:${key}={...}>\`)`, bold, normal);
17-
} else {
18-
// TODO print a link to the documentation
19-
console.warn("binding_non_existent_prop");
20-
}
21-
}
22-
238
/**
249
* `%binding%` (%location%) is binding to a non-reactive property
2510
* @param {string} binding

packages/svelte/tests/runtime-runes/samples/props-bindable-non-existent/_config.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,5 @@ import { test } from '../../test';
33
export default test({
44
compileOptions: {
55
dev: true
6-
},
7-
8-
warnings: [
9-
'A component is attempting to bind to a non-existent property `content` belonging to Input.svelte (i.e. `<Input bind:content={...}>`)'
10-
]
6+
}
117
});

0 commit comments

Comments
 (0)