chore: improve readonly prop messaging (#9901)

pull/9899/head
Dominic Gannaway 11 months ago committed by GitHub
parent 436a6c3dc4
commit 4e61db7201
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,5 @@
---
'svelte': patch
---
chore: improve readonly prop messaging

@ -42,7 +42,7 @@ export function readonly(value) {
*/ */
const readonly_error = (_, prop) => { const readonly_error = (_, prop) => {
throw new Error( throw new Error(
`Non-bound props cannot be mutated — use \`bind:<prop>={...}\` to make \`${prop}\` settable. Fallback values can never be mutated.` `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.`
); );
}; };

@ -15,5 +15,5 @@ export default test({
}, },
runtime_error: runtime_error:
'Non-bound props cannot be mutated — use `bind:<prop>={...}` to make `count` settable. Fallback values can never be mutated.' '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.'
}); });

@ -15,5 +15,5 @@ export default test({
}, },
runtime_error: runtime_error:
'Non-bound props cannot be mutated — use `bind:<prop>={...}` to make `count` settable. Fallback values can never be mutated.' '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.'
}); });

Loading…
Cancel
Save