-
Notifications
You must be signed in to change notification settings - Fork 1k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
typescript configuration should be more strict #1890
Comments
This sounds reasonable to me, I'd be interested to see how much would need to be fixed. |
@LFDanLu |
Having to add |
@dannify One possible method could be to bulk modify every function and add |
This is something I would be interested in doing. We would need it on all props as well. An option I'd like to explore is to handle this at build time instead of in the source code. |
@dannify I made a babel plugin that adds |
I think this is something we would be able to build on and use. It would also need to include all types, including Object properties, within the component packages and the shared types as well (not just function parameters). |
K I will add object values of functions parameters too. @dannify What do you mean by
|
A lot of our packages use the @react-types package for their types (mostly in React Aria and React Spectrum) |
@dannify So I looked at https://github.com/adobe/react-spectrum/blob/main/packages/%40react-types/textfield/src/index.d.ts and it exports interfaces. So I will make the babel plugin make every property in the interface optional. |
Ok great! Next week we have a break but I can take a look when we are back. Thanks for the update |
Another thing to consider is enabling i.e. all optional types should have |
馃摑 Feedback
Current typescript configuration doesn't have any of the
strict
flags. While it might not be the biggest problem for users of @react-spectrum packages, for users of @react-aria and @react-stately, it can cause problems which are mostly related tostrictNullCheck
flag.A couple of examples of these problems:
KeyboardDelegate
methods should be nullable.undefined
value while they should [react-stately][useControlledState] value param should be optional聽#1859馃敠 Context
We are using @react-aria and @react-stately to implement our own design system, and we have
strict
flag turned on in our tsconfig.Suggestion
I suggest turning
strict
flag on. Or at leaststrictNullCheck
. I would be happy to contribute by fixing current errors that would appear bystrict
flag.It might be hard to fix all errors at once, because of conflict, PR size, etc. It can be split into a few PRs where the change to strict flag is committed in the last one.
The text was updated successfully, but these errors were encountered: