I have Node-express code where modules are exported by using module.exports. For example, to export a function, it is written module.exports = functionName. Now the code will be converted to typescript. How to replace module.exports in typescript?
Just use export followed by the typical declaration, no matter whether it is a const, function, interface, enum, you name it.
export const myTestConst = () => console.log('hello world');
See https://www.typescriptlang.org/docs/handbook/modules.html
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