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

Generated types invalid for routes with a rest parameter #4327

Closed
TravisSpomer opened this issue Mar 14, 2022 · 0 comments · Fixed by #4361
Closed

Generated types invalid for routes with a rest parameter #4327

TravisSpomer opened this issue Mar 14, 2022 · 0 comments · Fixed by #4361

Comments

@TravisSpomer
Copy link
Contributor

TravisSpomer commented Mar 14, 2022

Describe the bug

The automatically generated types file for routes with a rest parameter are incorrect.

If you create a file called [...foo].svelte and then inspect the [...foo].d.ts file that gets generated, you'll see that the code isn't valid:

// this file is auto-generated
import type { Load as GenericLoad } from '@sveltejs/kit';
export type Load<Props = Record<string, any>> = GenericLoad<{ ...foo: string }, Props>;

If the ... in front of foo in GenericLoad is removed, the generated code would be valid and correct.

Reproduction

Just create a file called [...foo].svelte in any project. It doesn't need to have any contents.

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz   
    Memory: 21.02 GB / 31.93 GB
  Binaries:
    Node: 16.14.0 - C:\Program Files\nodejs\node.EXE        
    Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD 
    npm: 8.5.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (99.0.1150.39)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    @sveltejs/adapter-static: ^1.0.0-next.29 => 1.0.0-next.29
    @sveltejs/kit: ^1.0.0-next.296 => 1.0.0-next.296
    svelte: ^3.46.4 => 3.46.4

Severity

annoyance+ (it's a compilation error that might break builds in some environments)

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

Successfully merging a pull request may close this issue.

1 participant