Is there a way to create interfaces in ES6 / Node 4?

Jérôme Verstrynge picture Jérôme Verstrynge · Sep 17, 2015 · Viewed 96.6k times · Source

ES6 is fully available in Node 4. I was wondering whether it includes a concept of interface to define method contracts as in MyClass implements MyInterface.

I can't find much with my Googling, but maybe there is a nice trick or workaround available.

Answer

gaelgillard picture gaelgillard · Sep 17, 2015

Interfaces are not part of the ES6 but classes are.

If you really need them, you should look at TypeScript which support them.