react-native-gifted-charts
react-native-gifted-charts copied to clipboard
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:
- Add a
tsconfig.json
in the root with{"extends": "@tsconfig/react-native/tsconfig.json"}
- Add
@tsconfig/react-native
to the dev dependencies (is a default in react native typescript projects) - Run typecheck
yarn tsc
ornpm run tsc
- See errors
Expected behavior There shouldn't be any errors.
@christophby whats the best way to get around this temporarily?
@1kDustin I'm using patch-package to put a // @ts-nocheck
on top of (almost) each file
First time trying out gifted charts. Are these errors new in the latest version, or have they always been there? Is it worse using an older version?
Since I'm not yet invested in this particular package, it just look nice for what I want, I don't really want to do some hacks of adding 'nocheck' to a bunch of files.
Any chance this will be fixed soon?
Hi @digitalthjarta These typescript errors have always been there. I'll try to fix them in coming 1 or 2 weeks.
Thank you!
Nice @Abhinandan-Kushwaha
One temporary fix, that is not ideal, is to add the noimplicitAny option to your tsconfig:
"compilerOptions": {
"noImplicitAny": false,
...
},
To enforce some of the rules enforced by that config option, you can utilize this typscript-eslint rule. Note that their docs say to prefer noImplicitAny
over this rule. Hopefully when types for this package are fixed, we can revert this rule.
what is the best way to workaround this?
Any updates here? We can not get a build with tsc build
This repo exports direct typescript code without bundling it, all typescript errors from this package (and gifted-core
) will be reported in your downstream user's projects.
Regardless of a user's tsconfig settings, these errors prevent teams from building or checking types on their own code.
This can be fixed if decide to either:
- Compile and bundle this package into JS
- PR: #559
- This will allow users to simply use
skipLibCheck: true
to ignore these issues
- Or keep serving pure typescript and fix types on this repo &
react-gifted-core
- PR for
react-gifted-core
: https://github.com/Abhinandan-Kushwaha/gifted-charts-core/pull/5
- PR for
- Or add
// @ts-nocheck
on all the files in this repo &react-gifted-core
Hi @digitalthjarta These typescript errors have always been there. I'll try to fix them in coming 1 or 2 weeks.
Any updates to this? Starting to feel like "Elon Musk two weeks" now. :)
Painful to see all github actions fail because of the missing types from this package.
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.
Here's a workaround for this issue: https://gist.github.com/araphiel/b3d13ade7f9fe69e99c3d053196557d2
Hope this can help 👋
Any updates on this @Abhinandan-Kushwaha ? :)
It seems expo eas build failed because of this type error.
// Saying this because npx tsc --noEmit
throw error on this library. Removing all the charts from the app , then build again did pass.
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:
- First I navigated to the module folder from project root:
cd ./node_modules/react-native-gifted-charts/src
- 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)
- After that I ran patch-package for updated module from my project root
npx patch-package react-native-gifted-charts
Any updates on this ?
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. 🎉