react / react/react-native

Wrong types in RCTDeviceEventEmitter

未关闭
#37,358 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Needs: Triage :mag: Never gets stale Newer Patch Available
主要语言
C++
星标
127k
派生
25.3k
平均合并
1 天 23 小时
30 天内合并 PR
4

描述

Description

On a recent update of React Native we noticed that the export of RCTDeviceEventEmitter types is wrong.

After the update, the export in .d.ts has been changed to export const:

https://github.com/facebook/react-native/blob/cbc28da666c2d103242ad36caad577c69ecc430b/packages/react-native/Libraries/EventEmitter/RCTDeviceEventEmitter.d.ts#L28-L29

But in the .js file, the export still with export default:

https://github.com/facebook/react-native/blob/cbc28da666c2d103242ad36caad577c69ecc430b/packages/react-native/Libraries/EventEmitter/RCTDeviceEventEmitter.js#L31-L32

React Native Version

0.71.8

Output of npx react-native info

System:
OS: macOS 13.2.1
CPU: (8) arm64 Apple M1
Memory: 102.47 MB / 8.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
Yarn: 3.3.1 - ~/.nvm/versions/node/v16.16.0/bin/yarn
npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
Watchman: 2023.04.24.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.12.0 - /Users/douglas.junior/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK:
API Levels: 30, 31, 33, 33
Build Tools: 30.0.2, 30.0.3, 31.0.0, 33.0.0, 34.0.0
System Images: android-32 | Google APIs ARM 64 v8a, android-32 | Google Play ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9477386
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 11.0.19 - /opt/homebrew/opt/openjdk@11/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.7 => 0.71.7
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

N/A

Snack, code example, screenshot, or link to a repository

N/A

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,将 packages/react-native/Libraries/EventEmitter/RCTDeviceEventEmitter.d.ts 与所引用行对应的 .js 文件进行比较。确认 RCTDeviceEventEmitter 的导入和类型定义方式,然后确认该声明与运行时导出一致,并且不会产生所报告的类型错误。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, react-native, typescript
领域
mobile-dev
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。