In TypeScript we can re-export modules in the following way:
export * from './validators'; // Re-export all exports
export { validate as stringValidator } from './validators/string'; // Re-export with changed name
My question is about whether it is possible to re-export as default, e.g. combine the following two statements into one:
import * as validators from './validators';
export default validators;
You can do it like this:
export { default } from './validators';
combine the following two statements into one
No. You need two statements.
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