sveltejs / sveltejs/kit

svelte-package missing type definitions and type duplicates

Open
#13,342 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pkg:svelte-package
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the bug

Image

If you create a component ex. Example.svelte and a svelte-file ex. example.svelte.ts it won't generate a example.svelte.d.ts causing type errors;

Image

If you create a class ex class Example and import that into a file with the same name Example.svelte ― it will have duplicate types after svelte-package

Image

Image

Reproduction

https://github.com/Refzlund/svelte-package-bug

Logs

System Info
System:
    OS: Windows 11 10.0.22631
    CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
    Memory: 10.37 GB / 31.93 GB
  Binaries:
    Node: 20.17.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.15.1 - C:\Program Files\nodejs\pnpm.CMD
    bun: 1.1.43 - ~\.bun\bin\bun.EXE
  Browsers: {}
  npmPackages:
    @sveltejs/adapter-auto: ^4.0.0 => 4.0.0
    @sveltejs/kit: ^2.0.0 => 2.16.0
    @sveltejs/package: ^2.0.0 => 2.3.7
    @sveltejs/vite-plugin-svelte: ^4.0.0 => 4.0.4
    svelte: ^5.0.0 => 5.19.0
    vite: ^5.4.11 => 5.4.11
Severity

annoyance

Additional Information

1st needs (perhaps) to be case-sensitive when checking if file exists.

2nd I think might inquire a warning, as I did do local testing on the library with no issues, published it, only for it to be "unusable" when I put it into use in a different project (ex. svelte-tably).

(Which is a shame, because svelte-tably is my hackathon entry and I cannot make changes to it🤣)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Refzlund/svelte-package-bug reproduction and the svelte-package entry point, focusing on the two reported cases: a .svelte.ts file without a generated declaration and duplicate types from matching class and component names. Done means the reproduction produces the expected type definitions without duplicates or resulting type errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.