You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that shadowing the variable msg in the function scope is valid JavaScript/TypeScript and should not affect the outer scope variable.
What is actually happening?
The first console.log produces a log message as expected.
But the second one raises a ReferenceError, indicating that the variable msg doesn't exist at all in the scope (not just undefined - the variable itself is missing):
HelloWorld.vue:17 Uncaught (in promise) ReferenceError: msg is not defined
at setup (HelloWorld.vue:17:36)
at callWithErrorHandling (vue.js?v=5b865bf9:2263:19)
at setupStatefulComponent (vue.js?v=5b865bf9:9983:25)
at setupComponent (vue.js?v=5b865bf9:9944:36)
at mountComponent (vue.js?v=5b865bf9:7300:7)
at processComponent (vue.js?v=5b865bf9:7266:9)
at patch (vue.js?v=5b865bf9:6782:11)
at ReactiveEffect.componentUpdateFn [as fn] (vue.js?v=5b865bf9:7490:9)
at ReactiveEffect.run (vue.js?v=5b865bf9:481:19)
at vue.js?v=5b865bf9:2591:25
Curiously, the error is not thrown if one removes the try/catch block in the function.
System Info
Any additional comments?
No response
The text was updated successfully, but these errors were encountered:
Vue version
3.5.13
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-amw4dfwg
Steps to reproduce
What is expected?
There should be no errors, and two log messages:
FIRST LOG HELLO WORLD!
SECOND LOG HELLO WORLD!
Note that shadowing the variable
msg
in the function scope is valid JavaScript/TypeScript and should not affect the outer scope variable.What is actually happening?
The first
console.log
produces a log message as expected.But the second one raises a ReferenceError, indicating that the variable
msg
doesn't exist at all in the scope (not just undefined - the variable itself is missing):Curiously, the error is not thrown if one removes the try/catch block in the function.
System Info
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: