Fix TypeScript module resolution for direct filter imports#119
Draft
Copilot wants to merge 3 commits into
Draft
Conversation
Co-authored-by: lukasoppermann <813754+lukasoppermann@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Types no longer found when importing filters directly
Fix TypeScript module resolution for direct filter imports
Jun 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a TypeScript module resolution issue that occurs when users upgrade to Style Dictionary v4 and switch to modern module resolution strategies (
moduleResolution: "bundler","node16", or"nodenext").Problem
When importing filters directly, users encountered the following error:
Root Cause
The
package.jsonexports configuration was missing explicit type declarations for subpath exports:Modern TypeScript module resolution requires explicit declaration of both JavaScript files and their corresponding TypeScript declaration files.
Solution
Updated the exports configuration to properly specify both
.jsand.d.tsfiles:This fix supports both import patterns:
import { isDuration } from 'style-dictionary-utils/filter/isDuration.js'import { isDuration } from 'style-dictionary-utils/dist/filter/isDuration.js'Verification
This is a minimal change that only updates the package.json exports configuration without modifying any source code.
Fixes #95.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.