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

Auto format doesn't work with {@render } #2462

Closed
zoaha opened this issue Aug 11, 2024 · 2 comments
Closed

Auto format doesn't work with {@render } #2462

zoaha opened this issue Aug 11, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@zoaha
Copy link

zoaha commented Aug 11, 2024

Describe the bug

seems auto-format doesn't work whenever there's a {anything here} declaration

Reproduction

<script>
    let { children } = $props();
</script>

<div class="outer">
    <div class="inner">
        <div class="container">
            {@render children()}
        </div>
        
        
    </div>
</div>

^will not auto format, comment out the line <!-- {@render children()} --> allows it to work again

Expected behaviour

expect auto format, in the case of the example, extra lines between the divs should be removed

System Info

  • OS: Windows
  • IDE: VSCode

Which package is the issue about?

No response

Additional Information, eg. Screenshots

No response

@zoaha zoaha added the bug Something isn't working label Aug 11, 2024
@zoaha
Copy link
Author

zoaha commented Aug 11, 2024

in addition, I closed and reopened vs code and now am getting a red squiggly on that line:
image

'children' is of type 'unknown'

everything still works, just a ts false error (not sure if should file separate bug)

wasn't there for the last 2 hrs

@jasonlyu123
Copy link
Member

Duplicate of #2338. Svelte 5 currently require a workspace version of prettier-plugin-svelte and a prettier config file.

https://github.com/sveltejs/kit/blob/main/packages/create-svelte/shared/%2Bprettier/.prettierrc

As for the second issue, in SveltKit's route files, the snippet children props may have auto-typing, but it needs explicit typing in other components.

<script>
    /**
     * @type {{children: import('svelte').Snippet}}
     */
    const {
        children
    } = $props();
</script>

@jasonlyu123 jasonlyu123 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants