Skip to content

chore: remove empty type output directories for removed routes - #17472

Merged
elliott-with-the-longest-name-on-github merged 3 commits into
sveltejs:mainfrom
ump45nose:fix/17452-remove-empty-type-dirs
Oct 30, 2026
Merged

elliott-with-the-longest-name-on-github merged 3 commits into
sveltejs:mainfrom
ump45nose:fix/17452-remove-empty-type-dirs

Conversation

@ump45nose

Copy link
Copy Markdown
Contributor

Fixes #17452

What

After svelte-kit sync removes generated $types files for a deleted route, it left the empty directory under .svelte-kit/types. Cleanup now walks empty directories bottom-up after deleting stale files, so removed routes leave no empty output dirs. Parent directories that still hold nested route types are kept.

Tests

  • Added removes empty output directories for removed routes and keeps parent directories that still have nested routes under a new Cleans up unused files describe in packages/kit/src/core/sync/write_types/index.spec.js.
  • Ran: pnpm exec vitest run src/core/sync/write_types/index.spec.js → 22 passed.

Checklist

  • References an issue
  • Includes a test that fails without this PR
  • Changeset included (patch)
  • Allow edits from maintainers

AI assistance disclosure

Drafted with an AI coding agent; I reviewed the diff, ran the write_types unit tests, and take responsibility for this PR.

After a route is deleted, sync already removes its generated $types files
but leaves the empty directory under .svelte-kit/types. Walk empty dirs
bottom-up after file cleanup so removed routes leave no empty output
directories, while nested routes that still exist keep their parents.

Fixes sveltejs#17452
@pkg-svelte-dev

pkg-svelte-dev Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 2ea536a:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/2ea536a0926841428ca393d1a2f399fd63686f28

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

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 Oct 15, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2ea536a

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

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit 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

Inserting remove_empty_directories between the write_all_types JSDoc
and its export left the parameters untyped under check, so tsc failed
with implicit any errors on config/manifest_data/root/route.
@teemingc teemingc changed the title fix: remove empty type output directories for removed routes chore: remove empty type output directories for removed routes Oct 16, 2026
# Conflicts:
#	packages/kit/src/core/sync/write_types/index.spec.js
@elliott-with-the-longest-name-on-github
elliott-with-the-longest-name-on-github merged commit 3da859a into sveltejs:main Oct 30, 2026
37 of 38 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 30, 2026
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 this pull request may close these issues.

sync: remove empty type output directories for removed routes

2 participants