Maybe someone can tell me where I’m going wrong wi...
# prisma-whats-new
n
Maybe someone can tell me where I’m going wrong with Functions.
const fromEvent = require('graphcool-lib').fromEvent;
works.
const { fromEvent } = require('graphcool-lib')
doesn’t. Examples use a mixture of these. Halp
a
'use latest'
?
n
lol how have I not seen this before
Does that go at the top of my function?
a
Yes, to enable ES6 features like the object destructuring that you're trying to use
n
My function fails to save if I insert that. Ugh. Not having a good evening.
a
between single quotes?
n
Yeah.
a
At the top of the code (so outside your function)
n
Yeah I did that. So here’s what happened..
n
Updated my function to include
'use latest';
And at the same time updated the
const {fromEvent}
line.
Didn’t work. I then… changed the
const fromEvent
line back to ES5 and saved. Then updated the file again, back to the other way and it now works.
Its done it twice, I repeated the step. Perhaps a bug
a
Ah well...