Skip to content

fix: Preserve StyleX type constraints in published declarations - #535

Draft
xixa wants to merge 1 commit into
react:mainfrom
xixa:fix/stylex-type-reexports
Draft

xixa wants to merge 1 commit into
react:mainfrom
xixa:fix/stylex-type-reexports

Conversation

@xixa

@xixa xixa commented Nov 30, 2026

Copy link
Copy Markdown

Summary

React Strict DOM 0.0.55 reports four TS2344 errors in each of its generated entry points when TypeScript checks dependency declarations. The aliases for StyleTheme, StyleVars, Styles, and StylesWithout pass unconstrained type parameters to StyleX types that require constraints.

Re-export the StyleX types under the same public names on web and native. The generated declarations inherit the original constraints directly from StyleX.

Test plan

Generate declarations from both main and this branch. In a consumer with React 19 types and StyleX installed, use an entry file that imports a type from react-strict-dom:

import type { Styles } from 'react-strict-dom';

export type ColorStyles = Styles<{ color: string }>;
tsc --noEmit --strict --skipLibCheck false --module esnext --moduleResolution bundler --target es2022 index.ts

Add --customConditions react-native for the native entry point. With TypeScript 7.0.2 and StyleX 0.18.3 or 0.19.2, both entry points report four TS2344 errors on main and pass on this branch. The patched declarations also reject invalid theme and style arguments.

The workspace build, formatting, lint, Flow, and Jest checks pass.

@meta-cla meta-cla Bot added the cla signed label Nov 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant