mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Throw when extendsProps is empty
Summary:
If I understand the code correctly, component.extendsProps is expected to have more than 1 entry. I encounter a bug where it was an empty and produced an broken Props.h file while testing out in OSS.
```
// Example of the broken file.
class RNTMyNativeViewProps final : {
public:
```
In this diff, it makes it clear that the function has failed so that the codegen fails when the input is wrong.
There is probably an upstream problem that we should warn about, but this diff is just to make sure this method fails loudly.
Changelog: [Internal]
Reviewed By: hramos
Differential Revision: D30847173
fbshipit-source-id: 34c894f0a7bb81e132b6ed44f51d0f92ed9a5a20
This commit is contained in:
committed by
Facebook GitHub Bot
parent
99bad7015a
commit
286df9000e
@@ -187,6 +187,9 @@ static inline std::string toString(const ::_ENUM_MASK_:: &value) {
|
||||
`.trim();
|
||||
|
||||
function getClassExtendString(component): string {
|
||||
if (component.extendsProps.length === 0) {
|
||||
throw new Error('Invalid: component.extendsProps is empty');
|
||||
}
|
||||
const extendString =
|
||||
' : ' +
|
||||
component.extendsProps
|
||||
|
||||
Reference in New Issue
Block a user