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

Project won't compile after upgrade to 5.3.3 #313

Closed
justasdev opened this issue Feb 11, 2022 · 4 comments
Closed

Project won't compile after upgrade to 5.3.3 #313

justasdev opened this issue Feb 11, 2022 · 4 comments

Comments

@justasdev
Copy link
Contributor

justasdev commented Feb 11, 2022

Versions

package version
react 17.0.2
rsuite-table 5.3.3

What is the expected behavior?

Project should compile as before

What is the current behavior?

Project won't compile

What are the steps to reproduce?

Just update the rsuite-table version and build fails.

Any additional comments? (optional)

Looks like this change causes the issue. The error is An index signature parameter type must be either 'string' or 'number'.
BTW thanks for fixing #304 so fast!

image

Maybe this would fix the issue?
image

@simonguo
Copy link
Member

hi @justasdev
What version of typescript are you using? Try upgrading to the latest typescript, it should have been fixed.

@justasdev
Copy link
Contributor Author

justasdev commented Feb 17, 2022

Hi @simonguo
Our TS version is 4.3.5 and I see that support for symbols as indexes was added in 4.4 (August 2021). Haven't tried upgrading typescript version yet, it is not so trivial in a big project because of number of dependencies which some of them may not support the latest version of typescript. And I believe most of the projects would have exact same issue, because this feature is pretty new in typescript.
It looks as a breaking change which should not go into patch version upgrade IMO, especially if there is a non-breaking alternative, I would go for it.
It's up to you though, we will either upgrade rsuite-table after upgrading typescript or fork this repo and fix it manually.

@simonguo
Copy link
Member

image
Such a solution will still throw an error if strict mode is enabled in versions below TS 4.4.

 Type 'unique symbol' cannot be used as an index type.

My suggestion is to skip the check for node_modules . Modify skipLibCheck in tsconfig.json

{
  "skipLibCheck": true
}

If you have a better solution to fix it you can submit a PR and I will release a new version for you.

@justasdev
Copy link
Contributor Author

@simonguo sorry for delayed response. skipLibCheck is not working too, because it works only with definition files.
We've just ignored this issue so far and not upgraded the lib.
However, I've investigated this issue and seems like the only solution is declaring symbol's type as string and casting to any. Probably it could be solved with further refactoring - not attaching data to row directly but making a map which maps rows to it's internal state (PARENT_KEY etc..), but it brings unnecessary complexity just to work around typescript bug . Here is a PR for fixing it for those who uses this great table library with older typescript.

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

2 participants