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

chore: adds new strict rules for TypeScript #5644

Merged

Conversation

matuzalemsteles
Copy link
Member

Fixes LPS-190200

Well, this PR reduces the amount of TypeScript errors for environments with more restricted configurations, there are some rules that we cannot add due to errors in other libs that we use and others because it forces our code to be more redundant in an unnecessary way because they are configurations of taste and not something that really helps.

So we are not covering use cases here for:

  • exactOptionalPropertyTypes - This seems to be more a property of personal taste than something that really helps with typing because it renders the name?: string syntax useless to force type undefined in the whole optional property, this is something that makes it quite verbose too and breaks the build of internal dependencies that we couldn't change, for example the types for @types/react and @types/react-dom.
  • noImplicitReturns - Most of our cases are the return function inside a condition in un useEffect, always forcing the return for these use cases leaves our code too redundant to do property checks and add the useEffect clean up unnecessarily for use cases where we don't want it.

In this ticket also seems to always happen a bug of TS2786: 'Component' cannot be used as a JSX component. this is normally caused due to version incompatibility, for example we use the dependency of the types of @types/react and @types/react-dom both in version v16.9.9 due to the version we use and also to avoid conflicts with the portal. In this case, we recommend the team to try to normalize the type versions to maintain compatibility with the v16.x.x version.

@matuzalemsteles matuzalemsteles merged commit 5282371 into liferay:master Jul 25, 2023
2 checks passed
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

Successfully merging this pull request may close these issues.

1 participant