Skip to content

fix(AG-17604): add missing subpath exports for tsgo compatibility#1315

Merged
amir-zahedi merged 1 commit intomainfrom
fix/AG-17604-exports-compatibility
Feb 25, 2026
Merged

fix(AG-17604): add missing subpath exports for tsgo compatibility#1315
amir-zahedi merged 1 commit intomainfrom
fix/AG-17604-exports-compatibility

Conversation

@amir-zahedi
Copy link
Contributor

Summary

The tree-shaking exports change in 4.53.0 (AG-18132) introduced a package.json exports field. Strict TypeScript resolvers (tsgo / @typescript/native-preview 7.0) enforce this field, causing TS2307 errors in MFE consumers because:

  1. Several symbols were not re-exported from component indexes after export * was replaced with named exports
  2. The ./dist/* catch-all lacked a types condition
  3. ./themes and ./utils barrel exports were missing (unlike ./hooks and ./styles)
  4. Directory-based theme imports (themes/base, themes/flat_red, themes/neutral) didn't resolve through the ./themes/* wildcard (it maps to *.js not */index.js)

Component index additions

Component Export added Reason
Positioner EAlignment (alongside existing EPositionerAlignment) Used by ~50 MFE files
Radio useRadioContext Used by MFE Formik integration
Badge type BadgeProps Used by 1 MFE file
Columns type SprinklesColumnWidth Used by 1 MFE file
OverdriveProvider type ProviderProps Used by 1 MFE file

New public component

  • HintText — re-exported from private/InputBase/HintText via new components/HintText/index.ts. Used by 8 MFE files. Covered by the existing ./components/* wildcard export.

Exports field changes

  • Added ./themes barrel export (matches existing ./hooks, ./styles pattern)
  • Added ./utils barrel export
  • Added ./themes/base, ./themes/flat_red, ./themes/neutral explicit directory exports (placed before ./themes/* wildcard for correct precedence)
  • Added ./package.json self-reference (tooling compatibility — Vite dep pre-bundling)
  • Changed ./dist/* from bare string to object with types condition (transitional safety net for strict resolvers)

Tree-shaking impact

All additions are targeted named exports — no export * patterns introduced. The ./dist/* catch-all is retained as a transitional safety net and should be tracked for removal in a future release once MFE migration is validated.

Test plan

  • yarn build passes
  • yarn lint:tsc passes
  • MFE yarn overdrive:local + yarn lint passes with corresponding MFE import migration
  • dist/components/HintText/index.d.ts generated after build
  • No regressions in existing component exports

…go compatibility

The tree-shaking exports change in 4.53.0 (AG-18132) introduced an exports
field that strict TypeScript resolvers (tsgo / @typescript/native-preview 7.0)
enforce. Several symbols used by MFE consumers were not re-exported from
component indexes, and the ./dist/* catch-all lacked a types condition.

Component index additions:
- Positioner: EAlignment (alongside EPositionerAlignment)
- Radio: useRadioContext
- Badge: BadgeProps type
- Columns: SprinklesColumnWidth type
- OverdriveProvider: ProviderProps type

New public component:
- HintText: re-export from private/InputBase/HintText

Exports field additions:
- ./themes and ./utils barrel exports
- ./themes/base, ./themes/flat_red, ./themes/neutral directory exports
- ./package.json self-reference
- types condition on ./dist/* catch-all

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@amir-zahedi amir-zahedi requested a review from a team as a code owner February 25, 2026 01:54
@changeset-bot
Copy link

changeset-bot bot commented Feb 25, 2026

🦋 Changeset detected

Latest commit: 4a08f08

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

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

@amir-zahedi amir-zahedi merged commit b8215bd into main Feb 25, 2026
6 of 8 checks passed
@amir-zahedi amir-zahedi deleted the fix/AG-17604-exports-compatibility branch February 25, 2026 01:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes TypeScript strict-resolver (tsgo / @typescript/native-preview) compatibility issues introduced by the package.json#exports field, primarily by restoring missing public entrypoints/types and adding explicit subpath exports for themes/utils.

Changes:

  • Adds missing named exports/type exports to several component index.ts files (e.g. useRadioContext, EAlignment, and various prop/types).
  • Introduces a new public HintText barrel export re-exported from a previously private path.
  • Updates package.json#exports to add ./themes, ./utils, explicit theme directory exports, ./package.json, and a types condition for the ./dist/* catch-all.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
package.json Expands exports map with themes/utils barrels, explicit theme dirs, ./package.json, and adjusts ./dist/* to include types.
lib/components/Radio/index.ts Re-exports useRadioContext from RadioGroup.
lib/components/Positioner/index.ts Re-exports EAlignment alongside the existing alias EPositionerAlignment.
lib/components/OverdriveProvider/index.ts Re-exports ProviderProps type.
lib/components/HintText/index.ts Adds new public HintText/HintTextProps re-export.
lib/components/Columns/index.ts Re-exports SprinklesColumnWidth type.
lib/components/Badge/index.ts Re-exports BadgeProps type.
.changeset/fix-exports-compatibility.md Adds a changeset describing the compatibility fix.

@@ -1,2 +1,2 @@
export { Radio } from './Radio';
export { RadioGroup } from './RadioGroup';
export { RadioGroup, useRadioContext } from './RadioGroup';
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

Now that useRadioContext is being exported from the public Radio entrypoint, its current implementation (useContext(RadioContext)!) will throw an unhelpful runtime error if used outside a RadioGroup. Consider changing useRadioContext to validate the context and throw an invariant with a clear message (or return RadioGroupContext | null), similar to other public context hooks like useTableContext / useToast.

Suggested change
export { RadioGroup, useRadioContext } from './RadioGroup';
export { RadioGroup } from './RadioGroup';

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +2
export { HintText } from '../private/InputBase/HintText';
export type { HintTextProps } from '../private/InputBase/HintText';
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

HintText is being added as a public component export, but the underlying component (private/InputBase/HintText) does not set a displayName (many components in this repo do). To keep component naming consistent in React DevTools and tests, consider adding HintText.displayName = 'HintText' in the component definition file now that it’s part of the public API surface.

Suggested change
export { HintText } from '../private/InputBase/HintText';
export type { HintTextProps } from '../private/InputBase/HintText';
import type { FC } from 'react';
import { HintText as PrivateHintText } from '../private/InputBase/HintText';
import type { HintTextProps as PrivateHintTextProps } from '../private/InputBase/HintText';
export type HintTextProps = PrivateHintTextProps;
/**
* Public HintText component wrapper.
*
* Ensures a stable displayName for React DevTools and tests
* while delegating all rendering to the internal implementation.
*/
export const HintText: FC<HintTextProps> = (props) => <PrivateHintText {...props} />;
HintText.displayName = 'HintText';

Copilot uses AI. Check for mistakes.
},
"./dist/*": "./dist/*"
"./dist/*": {
"types": "./dist/*.d.ts",
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

./dist/* export's types mapping (./dist/*.d.ts) will produce incorrect paths for common subpaths, e.g. an import like @autoguru/overdrive/dist/index.js would resolve types to ./dist/index.js.d.ts (non-existent). Consider switching the types target to ./dist/* (letting TS resolve .d.ts / index.d.ts), or adding a more specific ./dist/*.js export pattern mapping to ./dist/*.d.ts and leaving ./dist/* as a fallback.

Suggested change
"types": "./dist/*.d.ts",
"types": "./dist/*",

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants