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

Wrong types are genereted for snippets with optional arguments #2406

Closed
7nik opened this issue Jun 17, 2024 · 1 comment
Closed

Wrong types are genereted for snippets with optional arguments #2406

7nik opened this issue Jun 17, 2024 · 1 comment
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.

Comments

@7nik
Copy link

7nik commented Jun 17, 2024

Describe the bug

Optional arguments became required, and arguments with fallbacks, except the first one, are thrown away from the typing.

Reproduction

{#snippet snip1(a = "", b = "", c = "")}
  {a}{b}{c}
{/snippet}
<!-- (local var) snip1: (this: void, args_0: any) => typeof SnippetReturn & {_: "...";} -->
{@render snip1("", "", "")} <!-- Error: Expected 1 arguments, but got 3. -->

{#snippet snip2(a?: string, b?: string, c?: string)}
  {a}{b}{c}
{/snippet}
<!-- (local var) snip2: (this: void, args_0: string, args_1: string, args_2: string) => typeof SnippetReturn & {_: "...";} -->
{@render snip2()} <!-- Error: Expected 3 arguments, but got 0. -->

Expected behaviour

No typing errors.

System Info

  • Version: 1.89.1
  • Commit: dc96b837cf6bb4af9cd736aa3af08cf8279f7685
  • Date: 2024-05-16T09:26:03.059Z
  • Electron: 28.3.3
  • ElectronBuildId: undefined
  • Chromium: 120.0.6099.291
  • Node.js: 18.18.2
  • V8: 12.0.267.19-electron.0
  • OS: Linux x64 6.6.32-1-MANJARO
  • Svelte for VSCode: v108.5.0
  • svelte-check: 3.8.4

Which package is the issue about?

Svelte for VS Code extension

Additional Information, eg. Screenshots

No response

@7nik 7nik added the bug Something isn't working label Jun 17, 2024
@7nik
Copy link
Author

7nik commented Jun 17, 2024

The first case seems to be caused by sveltejs/svelte#12067

@dummdidumm dummdidumm added the Fixed Fixed in master branch. Pending production release. label Jun 24, 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 Fixed Fixed in master branch. Pending production release.
Projects
None yet
Development

No branches or pull requests

2 participants