Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript errors #473

Closed
christophby opened this issue Dec 18, 2023 · 18 comments
Closed

Typescript errors #473

christophby opened this issue Dec 18, 2023 · 18 comments

Comments

@christophby
Copy link
Contributor

christophby commented Dec 18, 2023

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.

@1kDustin
Copy link

@christophby whats the best way to get around this temporarily?

@christophby
Copy link
Contributor Author

christophby commented Dec 27, 2023

@1kDustin I'm using patch-package to put a // @ts-nocheck on top of (almost) each file

@digitalthjarta
Copy link

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?

@Abhinandan-Kushwaha
Copy link
Owner

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

@digitalthjarta
Copy link

Thank you!

@christophby
Copy link
Contributor Author

Nice @Abhinandan-Kushwaha

@jasonleibowitz
Copy link

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.

@bryanltobing
Copy link

what is the best way to workaround this?

@dogancancelik12
Copy link

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

@araphiel-nf
Copy link
Contributor

araphiel-nf commented Feb 29, 2024

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:

@tfsjohan
Copy link

tfsjohan commented Mar 3, 2024

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.

@Abhinandan-Kushwaha
Copy link
Owner

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.

@araphiel
Copy link

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

Hope this can help 👋

@christophby
Copy link
Contributor Author

Any updates on this @Abhinandan-Kushwaha ? :)

@cjmling
Copy link

cjmling commented Apr 8, 2024

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.

@rodnoycry
Copy link

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

@kuldip-simform
Copy link

Any updates on this ?

@Abhinandan-Kushwaha
Copy link
Owner

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. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests