mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Improve error when using mutable object as prop
Summary: I was trying to add an object property to my ViewManager and got a really opaque error (and I almost thought Objects weren't supported by the codegen) until I realized it expected the object to wrapped in a $ReadOnly type. Changelog: [Internal] Improved error in codegen Reviewed By: mdvacca Differential Revision: D34006557 fbshipit-source-id: b3ab15a40cb66fdcd377f4e68df92060498e8e7f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
31a92b008d
commit
b0bae21249
@@ -319,6 +319,10 @@ function getTypeAnnotation(
|
||||
`Unsupported union type for "${name}", received "${unionType}"`,
|
||||
);
|
||||
}
|
||||
case 'ObjectTypeAnnotation':
|
||||
throw new Error(
|
||||
`Cannot use "${type}" type annotation for "${name}": object types must be declared using $ReadOnly<>`,
|
||||
);
|
||||
case 'NumberTypeAnnotation':
|
||||
throw new Error(
|
||||
`Cannot use "${type}" type annotation for "${name}": must use a specific numeric type like Int32, Double, or Float`,
|
||||
|
||||
Reference in New Issue
Block a user