Handle (T) and undefined properly in turbo module component codegen#34693
Handle (T) and undefined properly in turbo module component codegen#34693ZihanChen-MSFT wants to merge 5 commits into
Conversation
c34e1c2 to
fd3e88f
Compare
cipolleschi
left a comment
There was a problem hiding this comment.
Thank you for taking the time for this PR.
I left a few comments and some improvements that we can apply. Let me know what do you think.
I also have the feeling that this PR is doing a little bit too much: support parenthesized types, changing null for undefined, refactoring, error handling... It will be better to split it in multiple PR, what do you think?
There was a problem hiding this comment.
I know that this probably does not change anything, but I think we should keep also the other syntax, without parenthesis, to make sure that all the use cases are covered.
There was a problem hiding this comment.
Sure, if you scroll down the file you will see a lot of similar thing, which remains unchanged. So cases without parenthesis are still covered.
There was a problem hiding this comment.
BubblingEventHandler cases below still covered syntax without parenthesis.
f90d355 to
fa8137d
Compare
Base commit: ab5f26b |
Hi, @cipolleschi , in general I do think smaller PR is better, but in this case, the "first event type argument could be void->undefined or null" one is just one line of code and it is embedded in the refactored code, and if I split into 2 PR it will get conflict no matter which one is merged first. So in this particular case I do think combining them in one is better. |
Base commit: ab5f26b |
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
This pull request was successfully merged by @ZihanChen-MSFT in 205cc9b. When will my fix make it into a release? | Upcoming Releases |
Summary
In
buildEventSchemaandbuildPropSchema, they check into property types to see if the given property could be converted into an event schema or a property schema. The original implementation only handles limited cases, I refactor them and make them easier to maintain.In
getPropertyTypeinevents.js, it handles(T)at a wrong place, fixed.In
getPropertyTypeinprops.js, it doesn't handle(T), fixed.And I also fixed some other issues to make the codegen reports error better.
There are many duplicated test cases that cover every piece of the code, I changed some of them so that it tests both original cases and new cases.
Changelog
[General] [Changed] - Handle (T) and undefined properly in turbo module component codegen
Test Plan
yarn jestpassed inpackages/react-native-codegen