Recently delving into TypeScript and encountering a perplexing issue for which I can't seem to locate a satisfactory explanation...
Let's suppose I have a function:
function test() {
function localAccessMethod() {
console.log('I am only accessible from inside the function :)');
}
this.exposedMethod = function () {
console.log('I can access local method :P');
localAccessMethod();
}
}
Now, the task at hand is to transform this function into a TypeScript class. Up until now, my progress is as follows:
class test {
constructor: {}
exposedMethod() {
console.log('I can access local method :P');
localAccessMethod();
}
}
The challenge lies in defining that local function within the TypeScript class without exposing it through the prototype or .this. Is there a way to achieve this?
Alternatively, how should I modify the source code to comply with TypeScript conventions? I aim to create a function that is accessible to all class methods only, without being exposed...