Check() on Methods with destructing


#1

Hi,

I’m getting the following error:

Exception while invoking method 'Sessions.addSession' Error: Did not check() all arguments during call to 'Sessions.addSession'

Here is my method:

  Meteor.methods({
    'Sessions.addSession'({sessionId, token}) {
      check(sessionId, Number);
      check(token, String);
      console.log('ID is: ', sessionId);
      return 'Success: ' + sessionId;
    }
  });

Now, to me it clearly looks like I’m doing a check() on the arguments, I’m guessing this is an issue with the check() package itself not supporting ES6 destructing?

Clearly there is an easy workaround by doing it manually or destructing onto a const, however, this is a very real world scenario of passing data around functions these days. Is this something that could ever be fixed? Or is it limited by the fact it’s compiling down to ES5?

Thanks


#2

Yeah, was also expecting this to work with check.