Closed Industrial closed 7 years ago
It's a little hacky, but here's a pattern that might work for you:
es6-class = ({superclass, ::}:ls-class) ->
``class extends superclass {}`` <<< ls-class then ..:: <<< ::
YourClass = es6-class class extends ParentClass
# Standard LiveScript class code here...
# except you can't have a custom constructor, sorry!
# The base class's constructor will always be used.
If your classes really need custom initialization code, you can probably find a way to hack that into es6-class
, but it'll be tricky.
there are many things we allow in LS classes that aren't allowed in ES classes, but it's true it'd be helpful being able to extends Array, Date, etc...
Thanks for the help
I decided to evade the problem entirely by using Knex.js inside my GraphQL resolvers and not Objection.js.
Hi.
I am using a library Objection.js which is an ORM. It has a class
Model
which I'd like to extend. The problem is that it exports ES6 classes, and I can't seem to use LiveScript classes to extend that.Is it possible to create a fuction that exports
class #{class-name} extends {#parent-class-name} { etc }
?