types.d.ts doesn't type-check against React Native 0.88: Touchable, ScrollViewProps and VirtualizedListProps

未關閉 適合新手
#548 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 12 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
72/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
react-native, typescript
領域
mobile-dev

研究方向

從 types.d.ts(第 1-30 行)開始,其中 Touchable、ScrollViewProps 和 VirtualizedListProps 被 augmented。檢查 React Native 0.88 的類型以查看被移除的 exports/generics,然後修復 extends 子句。當在 repro repo 上執行 npx tsc 沒有報告來自 react-native-css/types.d.ts 的錯誤時完成。

由索引模型根據 Issue 內容生成。

描述

Before submitting a new issue
  • I tested using the latest version of the library, as the bug might be already fixed.
  • I tested using a supported version of react native.
  • I checked for possible duplicate issues, with possible answers.
Bug summary

react-native-css/types (the reference nativewind-env.d.ts adds) augments react-native with names and extends clauses that React Native 0.88's generated types no longer have, so a project that checks declarations (skipLibCheck: false) gets errors from it (types.d.ts at 2421ea7):

  • Touchable is no longer exported by react-native.
  • interface ScrollViewProps extends ViewProps, ScrollViewPropsIOS, ScrollViewPropsAndroid, Touchable clashes with 0.88's own ScrollViewProps, and the className the file adds to ViewProps and ImagePropsBase makes ScrollViewProps, ImageBackgroundProps and KeyboardAvoidingViewProps unable to extend both of their bases.
  • VirtualizedListProps is no longer generic, so FlatListProps<ItemT> extends VirtualizedListProps<ItemT> fails.
Library version

0.0.0-nightly.2421ea7 (main at 2421ea77da52), and 3.1.0-rc.0

Environment info
Windows 11 10.0.26300, Node 26.12.1, npm 12.2.1, TypeScript 7.0.2, react-native 0.88.1, react 19.3.1, @types/react 19.3.0.
No app or native build is involved: the errors come from the type check alone.
Steps to reproduce
  1. Clone the reproducible example: a package.json with react-native 0.88.1 and react-native-css 0.0.0-nightly.2421ea7, a tsconfig.json with strict and skipLibCheck: false, and an index.ts holding only import type {} from 'react-native-css/types';.
  2. npm install --ignore-scripts
  3. npx tsc -p .

Expected: no error from react-native-css/types.d.ts.

Actual, among the output (the run also prints a few errors of React Native's own declarations, which are separate):

node_modules/react-native-css/types.d.ts(6,3): error TS2305: Module '"react-native"' has no exported member 'Touchable'.
node_modules/react-native-css/types.d.ts(22,13): error TS2320: Interface 'ScrollViewProps' cannot simultaneously extend types 'Readonly<Omit<Omit<ViewProps, "experimental_accessibilityOrder">, "StickyHeaderComponent" | "alwaysBounceHorizontal" | "alwaysBounceVertical" | "automaticallyAdjustContentInsets" | ... 62 more ... | "zoomScale"> & Omit<...> & Omit<...> & Omit<...>>' and 'ViewProps'.
node_modules/react-native-css/types.d.ts(29,42): error TS2315: Type 'VirtualizedListProps' is not generic.
node_modules/react-native/types_generated/Libraries/Components/Keyboard/KeyboardAvoidingView.d.ts(40,18): error TS2320: Interface 'KeyboardAvoidingViewProps' cannot simultaneously extend types ...
  Named property 'className' of types ...
node_modules/react-native/types_generated/Libraries/Image/ImageProps.d.ts(291,18): error TS2320: Interface 'ImageBackgroundProps' cannot simultaneously extend types ...
  Named property 'className' of types ...
Reproducible example repository

https://github.com/YevheniiKotyrlo/react-native-css-types-react-native-0-88

主要語言
TypeScript
星號
166
分支
45
平均合併
17 天 22 小時
30 天內合併 PR
3

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

nativewind/react-native-css 的其他 Issue

查看 nativewind/react-native-css 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。