fix: better error message for global variable assignments

pull/17036/head
paoloricciuti 4 weeks ago
parent e33f774877
commit 73b04755fa

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: better error message for global variable assignments

@ -22,7 +22,10 @@ export function validate_assignment(node, argument, context) {
const binding = context.state.scope.get(argument.name);
if (context.state.analysis.runes) {
if (binding?.node === context.state.analysis.props_id) {
if (
context.state.analysis.props_id != null &&
binding?.node === context.state.analysis.props_id
) {
e.constant_assignment(node, '$props.id()');
}

@ -0,0 +1,6 @@
import { test } from '../../test';
export default test({
error: 'x is not defined',
async test() {}
});
Loading…
Cancel
Save