mailjet / mailjet-apiv3-nodejs

[API v3] Official Mailjet API v3 NodeJS wrapper
https://dev.mailjet.com
MIT License
236 stars 69 forks source link

After release 2.0.0 node-mailjet fails with typings #12

Closed dohomi closed 8 years ago

dohomi commented 8 years ago

Hello, I use node-mailjet with Typescript. After the release with Promise I receive an error and my builds fails constantly without any success of fixing it:

return new Promise((resolve, reject) => {
W20160613-12:16:56.766(8)? (STDERR)                                         ^
W20160613-12:16:56.768(8)? (STDERR) SyntaxError: Unexpected token >

The code hangs at mailjet-client.js in line 172. Could you explain what to do making this package work with typescript?

Thanks

WeshGuillaume commented 8 years ago

I dont really know anything about typescript, but I would guess it has trouble dealing with the Promise class, which is global. If you have any configuration file where you can declare global variables, you can add Promise.

dohomi commented 8 years ago

I just figured out, that its not about the Promise but about the Fat Arrow function which my Typescript compiler seems to have trouble with. But I'm not sure about it. Is there a minimum version of NodeJs for this package? Because due to Meteor restriction I still run a very old 0.10.x version

WeshGuillaume commented 8 years ago

Well you should at least use Node 4 or 5 I guess, 0.10 is getting pretty old now that Node 6 is out..

Any way to update with Meteor ?

dohomi commented 8 years ago

Nope, there isn't much Meteor users can do about it. But they work on Node 4 and 6 integration. For the meantime I will use the Api 1.1.0 of this package which works so far quite well.

WeshGuillaume commented 8 years ago

Or maybe you can use babel to compile the package (?)

WeshGuillaume commented 8 years ago

Or you can use babel-register:

node-mailjet.js:

require('babel-register')
module.exports = require('node-mailjet')

I don't know how typescript would behave with this

WeshGuillaume commented 8 years ago

Hey what's up with this ?

dohomi commented 8 years ago

Hi @GuillaumeBadi as I'm running TypeScript with Meteor all the suggestions would not work in my usecase. As its very specific it has actually nothing to do with your API, I will close it. Beside that I am not using mailjet anymore because some important features were missing which I realised too late. Thanks for your quick response

WeshGuillaume commented 8 years ago

Hey @dohomi ! What kind of features was missing from the API / Mailjet ?

dohomi commented 8 years ago

Nothing is missing from the API. But I want to move all my email sendouts away from my servers to scheduled remarketing campaigns and Mailjet doesnt have this feature at all.. So I had to take a different service.

WeshGuillaume commented 8 years ago

You might have a look at this : http://dev.mailjet.com/guides/#send-marketing-campaigns