react-native-gifted-charts: Typescript errors

Describe the bug

Found 187 errors in 22 files.

If you run yarn tsc you’ll get 187 typescript errors in this project. Most of them are Parameter 'xyz' implicitly has an 'any' type.

To Reproduce Steps to reproduce the behavior:

  1. Add a tsconfig.json in the root with {"extends": "@tsconfig/react-native/tsconfig.json"}
  2. Add @tsconfig/react-native to the dev dependencies (is a default in react native typescript projects)
  3. Run typecheck yarn tsc or npm run tsc
  4. See errors

Expected behavior There shouldn’t be any errors.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 18 (7 by maintainers)

Most upvoted comments

Hi @christophby @1kDustin @digitalthjarta @jasonleibowitz @bryanltobing @dogancancelik12 @araphiel @tfsjohan @cjmling @rodnoycry @kuldip-simform 👋

react-native-gifted-charts is now shipping compiled js files instead of ts files from version 1.4.22 onwards. This should fix all type related issues. 🎉

Hi @digitalthjarta These typescript errors have always been there. I’ll try to fix them in coming 1 or 2 weeks.

Here’s a workaround for this issue: https://gist.github.com/araphiel/b3d13ade7f9fe69e99c3d053196557d2

Hope this can help 👋

Sorry @tfsjohan @dogancancelik12 for the delay. I could have released a new version with type fixes, but here’s an update.

The web counterpart of this library is almost ready. So I wanted to add types in such a way that it satisfies both- react-native and reactJS.

Check my new repo- https://github.com/Abhinandan-Kushwaha/react-gifted-charts

Expect this all to be ready by this weekend.

Any updates here? We can not get a build with tsc build

Here’s a workaround for this issue: https://gist.github.com/araphiel/b3d13ade7f9fe69e99c3d053196557d2

Hope this can help 👋

Windows 10 - I got some troubles running command to update every file from this guide, so I used this command in my cmd in order to add // @ts-nocheck line to every file:

  1. First I navigated to the module folder from project root:
cd ./node_modules/react-native-gifted-charts/src
  1. Then I ran this command to add // @ts-nocheck line to every file:
for /R %i in (*.ts *.tsx) do (echo // @ts-nocheck > temp & type %i >> temp & move /Y temp %i)
  1. After that I ran patch-package for updated module from my project root
npx patch-package react-native-gifted-charts