I am new to Typescript, but with my JAVA Knowledge, I believe exporting functions breaks Encapsulation principles.
for example:
hello.ts
** Below method will be called from outside ***
export const abcd=async()=>{
// some code
dcb()
}
**
1. Below method (dcb) is not used outside this file, do I need to export?
2. is it a best practise to export the method only for TDD development?
**
export const dcb=async()=>{
// some code
}
Questions:
- Does best practices say when to export a function and when not to?
- For TDD development, can we export any function to test it? isn’t it a violation of Encapsulation Principle(I believe it’s not a good Practice).
NOTE: In Typescript, we can have functions without classes; question is not related with Typescript classes.