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

Aperta
#59,941 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@dkarlovi ci sta già lavorando.

Dal 11/11/2026.

  • #59943 di @dkarlovi — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
javascript, react-native, typescript

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
C++
Stelle
127k
Fork
25.5k
Merge medio
3g 22h
PR unite (30g)
235

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di react/react-native

Tutte le issue di react/react-native

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.