Easing functions are typed as methods, so passing them trips @typescript-eslint/unbound-method

未关闭
#59,941 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

@dkarlovi 已经在做这个了。

开始于 2026年11月11日。

  • #59943 来自 @dkarlovi —— 未关闭

评估

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

调研方向

Start with Libraries/Animated/Easing.js and inspect the generated declaration at types_generated/Libraries/Animated/Easing.d.ts. Confirm the declarations expose the easing functions as properties with function types, then run the reproducer's ESLint command to check that passing Easing.cubic no longer triggers @typescript-eslint/unbound-method. An open pull request, #59943, is already linked to this issue.

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

描述

Needs: Attention Needs: Repro
Description

Libraries/Animated/Easing.js declares linear, ease, cubic etc. with method shorthand, so types_generated/Libraries/Animated/Easing.d.ts emits cubic(t: number): number;. None of them reads this, and the documented usage passes them unbound (easing: Easing.cubic), which fails typescript-eslint's recommendedTypeChecked (@typescript-eslint/unbound-method).

Fix: declare them as arrow-function properties, so the types become cubic: (t: number) => number.

Steps to reproduce
  1. Clone the reproducer gist.
  2. npm install --ignore-scripts
  3. npx eslint index.ts
React Native Version

0.88.1

Affected Platforms

Other (type definitions)

Output of npx @react-native-community/cli info
Not applicable: type definitions only, no app.
Stacktrace or Logs
4:46  error  A method that is not declared with `this: void` may cause unintentional scoping of `this` when separated from its object  @typescript-eslint/unbound-method
MANDATORY Reproducer

https://gist.github.com/dkarlovi/4c0a3edcec5fab42be4aec8eb6ff1d80

Screenshots and Videos

No response

主要语言
C++
星标
127k
派生
25.5k
平均合并
3 天 22 小时
30 天内合并 PR
235

环境准备

从这里开始

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

react/react-native 的其他 Issue

查看 react/react-native 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

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