-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
Description
Version: 7.6.0
Platform: Darwin 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar 3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64
function foo() { return {}; }
var [x,y] = foo(); // error claims that foo is not a functionHere is the error:
TypeError: foo is not a function
at repl:1:13
at ContextifyScript.Script.runInThisContext (vm.js:23:33)
at REPLServer.defaultEval (repl.js:334:29)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.onLine (repl.js:531:10)
at emitOne (events.js:101:20)
at REPLServer.emit (events.js:189:7)
at REPLServer.Interface._onLine (readline.js:238:10)
at REPLServer.Interface._line (readline.js:582:8)
This is a rather confusing output. In this example it's trivial to spot the problem, but I stumbled upon it in a more complex situation using argument destructuring and async functions inside a class. I was getting an error that read TypeError: undefined is not a function (because ES6 class methods are %s printed as undefined). A nicer error message would be helpful.