Skip to content

Commit 4e61db7

Browse files
authored
chore: improve readonly prop messaging (#9901)
1 parent 436a6c3 commit 4e61db7

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

.changeset/large-turkeys-deny.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
chore: improve readonly prop messaging

packages/svelte/src/internal/client/proxy/readonly.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function readonly(value) {
4242
*/
4343
const readonly_error = (_, prop) => {
4444
throw new Error(
45-
`Non-bound props cannot be mutated — use \`bind:<prop>={...}\` to make \`${prop}\` settable. Fallback values can never be mutated.`
45+
`Non-bound props cannot be mutated — to make the \`${prop}\` settable, ensure the object it is used within is bound as a prop \`bind:<prop>={...}\`. Fallback values can never be mutated.`
4646
);
4747
};
4848

packages/svelte/tests/runtime-runes/samples/proxy-prop-default-readonly/_config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ export default test({
1515
},
1616

1717
runtime_error:
18-
'Non-bound props cannot be mutated — use `bind:<prop>={...}` to make `count` settable. Fallback values can never be mutated.'
18+
'Non-bound props cannot be mutated — to make the `count` settable, ensure the object it is used within is bound as a prop `bind:<prop>={...}`. Fallback values can never be mutated.'
1919
});

packages/svelte/tests/runtime-runes/samples/proxy-prop-readonly/_config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ export default test({
1515
},
1616

1717
runtime_error:
18-
'Non-bound props cannot be mutated — use `bind:<prop>={...}` to make `count` settable. Fallback values can never be mutated.'
18+
'Non-bound props cannot be mutated — to make the `count` settable, ensure the object it is used within is bound as a prop `bind:<prop>={...}`. Fallback values can never be mutated.'
1919
});

0 commit comments

Comments
 (0)