I realize this is really simple but typescript seems to have changed a lot in the last years and i just cant get this done with previous answers i found here on stack overflow.
let myfunction = something that returns a function export myfunction;
I get an error "declaration or statement expected"
How can i export a function from a really simple ts file to be able to use the function in another ts file?
It seems that
let myfunction = something that returns a function export {myfunction};
will do the trick.
Use
export default myfunction
if you only have this function to export from this file. Otherwise use
export { myfunction, <other exports> }
to export myfunction
along with other types to export
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