Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conversion of module.exports from javascript to typescript

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?

like image 478
Sayan Sahoo Avatar asked Jun 07 '26 07:06

Sayan Sahoo


1 Answers

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

like image 123
wfreude Avatar answered Jun 10 '26 02:06

wfreude