I'm using es6 and therefore don't have class decorators. If I had class decorators I would do this:
@b
export class A {}
which would mean b(A) would be exported as A
However I don't have decorators so I have to do something like this:
class A {}
export const C = b(A)
but now my module exports b(A) as C but I want it to be exported as A.
Is there a way to change the name as I'm exporting to make this work?
You can choose a different name using export { ... }
syntax.
class A {}
const C = b(A)
export {C as A};
You could also potentially do
export const A = b(class A { });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With