Skip to content

Conversation

teemingc
Copy link
Contributor

@teemingc teemingc commented Sep 25, 2025

follow-up to #1770

This changes one of the imports in src/lib/theme/themeUtils.ts to be a type-only import. This helps avoid the error in the Svelte playground caused by an import to a non-existent directory. cc: @shinokada

Basically, the issue was this:

import { type ThemeConfig } from "$lib";

was being transformed into this:

import {} from "..";

But if we make it type-only:

import type { ThemeConfig } from "$lib";

It removes the entire import statement when compiled to JS.

📑 Description

Status

  • Not Completed
  • Completed

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation and api-check directory as required
  • All the tests and check have passed by running pnpm check && pnpm test:e2e
  • My pull request is based on the latest commit (not the npm version).
  • I have checked the page with https://validator.unl.edu/

ℹ Additional Information

Summary by CodeRabbit

  • Refactor

    • Updated internal type imports to type-only syntax, aligning with TypeScript standards and reducing unnecessary runtime imports. Minor build optimizations with no changes to behavior or UI.
  • Chores

    • Maintenance to improve code clarity and build hygiene. No configuration changes or user action required; no user-facing updates in this release.

Copy link

vercel bot commented Sep 25, 2025

@teemingc is attempting to deploy a commit to the Themesberg Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Sep 25, 2025

Walkthrough

The change updates an import in src/lib/theme/themeUtils.ts to use a type-only import for ThemeConfig from $lib, affecting TypeScript compilation only and not runtime behavior.

Changes

Cohort / File(s) Summary
Type-only import adjustment
src/lib/theme/themeUtils.ts
Converted ThemeConfig to a type-only import (import type { ThemeConfig } from "$lib";). No changes to exports or runtime logic.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • Theme provider #1695 — Defines/exports ThemeConfig in the theme module and re-exports it from $lib, directly connected to switching to a type-only import.

Poem

In the garden of types I hop with glee,
A nibble of imports, light as can be.
No runtime carrots moved today—
Just tidy stems tucked out of the way.
Thump-thump! The build runs clean and bright,
A rabbit’s joy in typings light.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The author added detailed explanation above the template placeholders, but the required '## 📑 Description' section remains empty and lacks the brief summary in the designated spot. The template structure expects the change summary to appear under that heading, but currently it is missing from that section. This misalignment with the repository’s description template renders the pull request description incomplete. Please restate the summary of the change under the '## 📑 Description' heading so that the brief description is in its designated section and aligns with the repository template. If this pull request closes an issue, add a 'Closes #' line at the top of the description. Populating all mandatory sections will ensure the PR description meets the required structure.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title “fix: avoid empty import” succinctly and accurately summarizes the primary change of switching to a type-only import to prevent an empty import at runtime, and it clearly conveys the intent of the fix without unnecessary detail.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@shinokada shinokada merged commit bd7d3e2 into themesberg:main Sep 25, 2025
1 of 2 checks passed
@shinokada
Copy link
Collaborator

Error with v1.14.2:

Error compiling component
Could not find dist/accordion/ in [email protected] (error occurred while trying to resolve ./ within npm://$/[email protected]/dist/accordion/Accordion.svelte)

image

@shinokada
Copy link
Collaborator

Is it because of this line in Accordion.svelte?

  import { type AccordionCtxType, type AccordionProps } from "$lib";

@teemingc
Copy link
Contributor Author

teemingc commented Sep 25, 2025

Is it because of this line in Accordion.svelte?

  import { type AccordionCtxType, type AccordionProps } from "$lib";

Yeah, I should have checked if there were more of these. My bad. Let me do a follow-up

@shinokada
Copy link
Collaborator

If that is the cause, shouldn't svelte side fix the problem?

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.

2 participants