functionfoo() {let someProperty;// Some other initialization codefunctionsomeMethod() {// Do some stuff with `someProperty`// And potentially other things }// Maybe some other methodsreturn { someMethod,// Maybe some other methods };}
let someProperty;functionfoo() {// Some initialization code}foo(); // some initialization codesomeProperty =123; // some more initialization// Some utility function not exported// laterexportfunctionsomeMethod() {}
classFoo {public someProperty;constructor() {// some initialization }publicsomeMethod() {// some code }privatesomeUtility() {// some code }}export=newFoo();