Skip to content

Commit 179b684

Browse files
rubennortefacebook-github-bot
authored andcommitted
Modify native module codegen to throw JS errors instead of crashing when not passing required parameters
Summary: Changelog: [General][Fixed] Fixed crash when passing fewer arguments than expected in native modules using codegen ## Context Right now, if you have a native module using the codegen with a method like this: ``` someMethod(value: number): void; ``` And you call it like this: ``` NativeModule.someMethod(); ``` The app crashes. This happens because the codegen tries to cast the value to the expected type without checking if the argument is within the bounds of the arguments array. ## Changes This fixes that issue with a change in the codegen to guard against this in the generated code (see changes in the snapshot tests). Reviewed By: RSNara Differential Revision: D54206287 fbshipit-source-id: 575af462725515928f8634fccc7a9cb51ca0ce4f
1 parent abbc6eb commit 179b684

File tree

3 files changed

+215
-216
lines changed

3 files changed

+215
-216
lines changed

0 commit comments

Comments
 (0)