Skip to content

className props disappear under React Native's Strict TypeScript API #635

Description

@Quraian

What happened?

Opting a project into React Native's Strict TypeScript API ("customConditions": ["react-native", "react-native-strict-api"]) makes every Uniwind className / *ClassName prop a type error — Property 'className' does not exist on type … on View, Text, Pressable, and the rest of the core components. In our app (Expo SDK 57 / RN 0.86.2) that's 341 errors across essentially every screen; the minimal repro below shows it with a single View + Text.

Mechanism: the strict tree (react-native/types_generated/) exports ViewProps, TextProps, etc. as generated type aliases (Readonly<Omit<…>>), while uniwind/types.d.ts adds its props via declare module 'react-native' interface merging into those names. An interface can't merge into a type alias, so the augmentation becomes an orphan interface and the props silently vanish — silently because skipLibCheck suppresses the collision inside the .d.ts. It's the same failure mode #627 described and fixed for VirtualizedListWithoutRenderItemProps, but affecting the whole core-component surface.

This gets urgent with RN 0.87, where the strict tree becomes the served default (react-native-legacy-deep-imports opt-out lasts through 0.88, with legacy types slated for removal after).

Steps to Reproduce

  1. npm install in the repro repo
  2. npm run typecheck → 2 × TS2322 Property 'className' does not exist
  3. Remove "react-native-strict-api" from customConditions in tsconfig.json, run npm run typecheck again → passes

Snack or Repository Link

https://github.com/Quraian/uniwind-strict-api-repro

Uniwind version

1.11.0

React Native Version

0.86.2 (repro also holds against 0.87, where strict is the default)

Platforms

iOS, Android (type-level — platform-independent)

Expo

Yes

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions