Skip to content

Conversation

@lee-chase
Copy link
Member

Contributes to #923

This is PR 1 of 2, which makes changes to the utilities package exports.

  • Adds TypeScript Support to @carbon-labs/utilities
  • packages/utilities/package.json - Added TypeScript exports, sideEffects: false for tree-shaking
  • packages/utilities/scripts/build.sh - Script to copy .d.ts files during build
  • Fix Rollup Resolution (packages/react/tasks/build.js)

What This Achieves

Makes @carbon-labs/utilities fully TypeScript-compatible. TypeScript projects can now import from this package with full type safety and IDE autocomplete. All existing JavaScript consumers continue to work unchanged.

Corrects the rollup resolution that was incorrectly using the selecting the src folder of @carbon-labs/utilities.

PR 2 will

  1. Update usage of @carbon-labs/utilties

e.g.

// Before
import { usePrefix } from '@carbon-labs/utilities/es/index.js';

// After
import { usePrefix } from '@carbon-labs/utilities';
  1. Update Dependencies from canary to latest and/or newes version number.
{
  "peerDependencies": {
    "@carbon-labs/utilities": "^0.17.0"
  }
}

Testing / Reviewing

The build still runs.

@lee-chase lee-chase requested a review from a team as a code owner November 21, 2025 14:31
@lee-chase lee-chase requested review from Gururajj77 and maradwan26 and removed request for a team November 21, 2025 14:31
@netlify
Copy link

netlify bot commented Nov 21, 2025

Deploy Preview for carbon-labs-react failed. Why did it fail? →

Name Link
🔨 Latest commit 72ed7e4
🔍 Latest deploy log https://app.netlify.com/projects/carbon-labs-react/deploys/692077a93ad2e100081c69dc

@netlify
Copy link

netlify bot commented Nov 21, 2025

Deploy Preview for carbon-labs-web-components ready!

Name Link
🔨 Latest commit b2932e6
🔍 Latest deploy log https://app.netlify.com/projects/carbon-labs-web-components/deploys/692079a8dda12d0008a59fbc
😎 Deploy Preview https://deploy-preview-927--carbon-labs-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@lee-chase lee-chase changed the title Fix utilities exports fix: utilities exports Nov 21, 2025
@lee-chase
Copy link
Member Author

@alisonjoseph @ariellalgilmore

I know we've had fun with exports before so I thought I'd try and split this up into the change required to @carbon-labs/utilities which is preventing adoption of Typescript in the Carbon-react-router-template project.

The second PR will address the 121 direct imports of @carbon/labs/utilities/es/....
In addition it would need to update the 22 imports some of which use old versions.

Copy link
Member

@alisonjoseph alisonjoseph left a comment

Choose a reason for hiding this comment

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

This LGTM, would like to get one more set of eyes on it before merging. @annawen1 are you able to take a quick look?

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