[Solved] Errors prevented startup : null is a reserved word

Hi, after upgrading to 1.5 and update --all-packages, I have the following error when building

=> Started MongoDB.
=> Errors prevented startup:
While building for web.browser:
imports/ui/containers/Deliver.js:19:21: null is a reserved word (19:21)
=> Your application has errors. Waiting for file change.

related code at line 19 is just

onData(null, { null, null });

Any idea ?

I think it’s because you’re destructuring is attempting to assign two local variables with the name null. currently your destructuring syntax doesn’t make any sense.

you’re probably trying to pass in the value of null for some specific key like this

onData(null, { someKey: null, anotherKey: null })

thank you @efrancis, will try that even if I’m not sure
In other part of the same code the same kind of call is

onData(null, { booking, box });

so you think I should change { null, null } to

onData(null, { booking: null , box: null });

maybe “booking” is a short for “booking: booking” ?

FYI I rolled back to @1.4.4.1 and it works as usual with { null, null }, changing to 1.5+ fails with this reserved word error…

maybe “booking” is a short for “booking: booking” ?

exactly, it essentially means “take the variable with the name ‘booking’, and assign it to a property of the same name”

so

const a = 1;
const b = { a }

is the equivalent of

const a = 1;
const b = {};
b.a = a;
2 Likes

As { booking } is a short for { booking: booking }, I’ve corrected with

onData(null, { booking: null , box: null });

and everything is working fine with meteor 1.5.
It’s very strange that it does not crash meteor 1.4.4 either :wink:
thank you @efrancis for your help.

1 Like