Skip to content

fix: emit declarations when the tsconfig lives above the package root - #16568

Merged
Rich-Harris merged 3 commits into
sveltejs:version-3from
Nic-Polumeyv:package-declaration-dir
Jul 30, 2026
Merged

fix: emit declarations when the tsconfig lives above the package root#16568
Rich-Harris merged 3 commits into
sveltejs:version-3from
Nic-Polumeyv:package-declaration-dir

Conversation

@Nic-Polumeyv

Copy link
Copy Markdown
Contributor

When a package's only tsconfig or jsconfig lives above the package root, no .d.ts reaches dist at all.

emitDts resolves a relative declarationDir against the tsconfig's directory rather than the cwd, so the declarations were written outside __package_types_tmp__ and the copy step never saw them. Absolute paths only started working in svelte2tsx 0.7.56 (sveltejs/language-tools#2965), so the bump and the fix are both needed.

Reported from the svelte2tsx side in sveltejs/language-tools#2182, where the kit half was spotted but never filed.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Jul 29, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 530e936:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/530e936fe0449082b5842d2359a00b595b0c144f

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/16568

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@changeset-bot

changeset-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 530e936

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/package Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Nic-Polumeyv
Nic-Polumeyv marked this pull request as ready for review July 29, 2026 19:31
0.7.56 is the first version that resolves an absolute declarationDir
(sveltejs/language-tools#2965).
svelte2tsx resolves a relative declarationDir against the tsconfig's
directory, so declarations landed outside the temp dir whenever the
tsconfig was not in the package root, and never got copied into dist.
@Nic-Polumeyv
Nic-Polumeyv force-pushed the package-declaration-dir branch from 04f32c1 to 530e936 Compare July 30, 2026 00:27
@teemingc teemingc added the pkg:svelte-package Issues related to svelte-package label Jul 30, 2026
@teemingc teemingc added this to the 3.x milestone Jul 30, 2026

@Rich-Harris Rich-Harris left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you

@Rich-Harris
Rich-Harris merged commit 131509a into sveltejs:version-3 Jul 30, 2026
20 of 21 checks passed
@Nic-Polumeyv
Nic-Polumeyv deleted the package-declaration-dir branch July 30, 2026 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg:svelte-package Issues related to svelte-package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants