react-native-css/metro's declarations import react-native, loading React Native's globals into a Node program
Maintainer thường phản hồi trong vòng 5 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 70/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- node.js, react-native, typescript
- Lĩnh vực
- tooling
Hướng nghiên cứu
Bắt đầu từ src/compiler/compiler.types.ts (dòng 8) và src/native/reactivity.ts (các dòng 1-8) để xem phần import VAR_SYMBOL kéo vào react-native. Chạy npx tsc -p . của repro với skipLibCheck: false để xác nhận 72 lỗi. Sửa lỗi là ngăn các khai báo kiểu import hằng số thời gian chạy từ phía native, sau đó xác minh metro.config.ts type-check mà không cần React Native globals.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
Typing a Metro config through react-native-css/metro (or nativewind/metro) loads React Native's types into a Node program. The compiler's declarations import a runtime constant from the native side: src/compiler/compiler.types.ts imports VAR_SYMBOL from ../native/reactivity, and src/native/reactivity.ts imports from react-native. React Native's declarations bring its runtime globals (fetch, AbortController, Blob, require…), which clash with @types/node's, so a metro.config.ts checked with skipLibCheck: false 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, @types/node 26.6.6, react-native 0.88.1.
No app or native build is involved: the errors come from the type check alone.
Steps to reproduce
- Clone the reproducible example: a
metro.config.tsholding onlyimport type {} from 'react-native-css/metro';, checked by atsconfig.jsonwith"types": ["node"]andskipLibCheck: false, besidereact-native0.88.1 andreact-native-css0.0.0-nightly.2421ea7. npm install --ignore-scriptsnpx tsc -p ., thennpx tsc -p . --explainFilesto see whyreact-nativeis in the program.
Expected: no error; a Metro config's types reach no React Native type.
Actual: 72 errors in Node's and React Native's globals. The first ones:
node_modules/@types/node/module.d.ts(711,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'require' must be of type 'NodeRequire', but here has type 'Require'.
node_modules/@types/node/web-globals/abortcontroller.d.ts(43,15): error TS2300: Duplicate identifier 'AbortController'.
node_modules/@types/node/web-globals/abortcontroller.d.ts(44,9): error TS2300: Duplicate identifier 'AbortController'.
node_modules/@types/node/web-globals/abortcontroller.d.ts(50,15): error TS2300: Duplicate identifier 'AbortSignal'.
node_modules/@types/node/web-globals/abortcontroller.d.ts(51,9): error TS2300: Duplicate identifier 'AbortSignal'.
and --explainFiles shows where React Native comes from:
node_modules/react-native/types_generated/index.d.ts
Imported via "react-native" from file 'node_modules/react-native-css/dist/typescript/module/src/native/reactivity.d.ts' with packageId 'react-native/types_generated/[email protected]+@types/[email protected][email protected]'
Reproducible example repository
https://github.com/YevheniiKotyrlo/react-native-css-metro-types-react-native
- Ngôn ngữ chính
- TypeScript
- Star
- 166
- Fork
- 45
- Merge trung bình
- 10 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nativewind/react-native-css
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
nativewind/react-native-css#554 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nativewind/react-native-css#548 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nativewind/react-native-css#545 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nativewind/react-native-css#544 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nativewind/react-native-css#543 ·
Maintainer thường phản hồi trong vòng 5 ngày
Tất cả issue của nativewind/react-native-css
Issue tương tự
-
Add: Yichang TVĐang mởcheck:passed streams:add
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
vtselect: data race in Tempo search tags APIs for invalid TraceQL queriesCó thể đã có người làm @Shubham19032004 đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
VictoriaMetrics/VictoriaTraces#304 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
test: claim-conflict drop leaves both facts active and is never re-proposed (untested review cell)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/vscode-pull-request-github#9159 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Feature]: Usage page should show API-equivalent cost and say when a connected plan shows info onlyĐang mởenhancement from-x
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
nightly-labs/openbot#4867 ·
Maintainer thường phản hồi trong vòng 1 ngày