React-native: instanceof error

Created on 8 Aug 2016  ·  1Comment  ·  Source: facebook/react-native

sample code error.js

class TypeError extends Error {};
const obj = new TypeError();
console.log('TypeError', obj instanceof TypeError);
console.log('Error', obj instanceof Error);

run node error.js
TypeError true
Error true

run babel-node error.js
TypeError true
Error true

but, run on react native.

2016-08-08 19:51:34.677 [info][tid:com.facebook.react.JavaScript] 'TypeError', false
2016-08-08 19:51:34.677 [info][tid:com.facebook.react.JavaScript] 'Error', true

I'd know why that TypeError is false,

node v6.3.1
react native v0.30

Locked

Most helpful comment

Please see this page -- http://stackoverflow.com/a/33877501/454967. It has more to do with JavaScript and Babel than React Native.

>All comments

Please see this page -- http://stackoverflow.com/a/33877501/454967. It has more to do with JavaScript and Babel than React Native.

Was this page helpful?
0 / 5 - 0 ratings