ios-jsc icon indicating copy to clipboard operation
ios-jsc copied to clipboard

Passing number to a method that expects NSString*

Open jasssonpet opened this issue 10 years ago • 1 comments

void TNSLog(NSString*);
TNSLog(5); // Converted to NSNumber instead and crashes

This behavior also happens in alert() calls.

jasssonpet avatar Jul 31 '15 08:07 jasssonpet

I'm almost tempted to properly implement canConvert for the Objective-C FFI types and throw an error during FFI if canConvert fails.

I think it would be better to throw an error here, rather than try to out-JavaScript JavaScript by inventing even more inexplicable type coercion rules.

fealebenpae avatar Jul 31 '15 08:07 fealebenpae