Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{@debug} displaying primitive values as undefined #2764

Closed
varholak-peter opened this issue May 15, 2019 · 2 comments · Fixed by #2766
Closed

{@debug} displaying primitive values as undefined #2764

varholak-peter opened this issue May 15, 2019 · 2 comments · Fixed by #2766
Labels

Comments

@varholak-peter
Copy link
Contributor

Minimal example

https://svelte.dev/repl/b2e23e4311244f6694ced9e116c249ca?version=3.3.0

Description

It seems that the {@debug ...} tag can't properly pull the primitive values into watcher's scope and as such, they end up being undefined, the same behavior is reflected in the console.log as part of debug where the variable is undefined as well.

However, standalone {console.log(...)} displays them correctly.

Screenshots

Screenshot 2019-05-14 at 20 44 07

Environment

Chrome v74, Svelte v3.3.0

@Conduitry Conduitry added the bug label May 15, 2019
@Conduitry
Copy link
Member

The destructuring and console.log statements are not respecting whether the variables in question have been hoisted. In this case, Svelte recognizes that let kobzol = 5; can be hoisted to the top-level scope, but this isn't reflected in the code generated for @debug.

@Rich-Harris
Copy link
Member

I strongly approve of kobzol as a placeholder variable name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants