As many have already stated, as much as you want to test the private methods you shouldn't hack your code or transpiler to make it work for you. Modern day TypeScript will deny most all of the hacks that people have provided so far.
Solution
TLDR; if a method should be tested then you should be decoupling the code into a class that you can expose the method to be public to be tested.
The reason you have the method private is because the functionality doesn't necessarily belong to be exposed by that class, and therefore if the functionality doesn't belong there it should be decoupled into its own class.
Example
I ran across this article that does a great job of explaining how you should tackle testing private methods. It even covers some of the methods here and how why they're bad implementations.
https://patrickdesjardins.com/blog/how-to-unit-test-private-method-in-typescript-part-2
Note: This code is lifted from the blog linked above (I'm duplicating in case the content behind the link changes)
Before
class User {
public getUserInformationToDisplay() {
//...
this.getUserAddress();
//...
}
private getUserAddress() {
//...
this.formatStreet();
//...
}
private formatStreet() {
//...
}
}
After
class User {
private address: Address;
public getUserInformationToDisplay() {
//...
address.format();
//...
}
}
class Address {
private format: StreetFormatter;
public format() {
//...
format.toString();
//...
}
}
class StreetFormatter {
public toString() {
// ...
}
}
A Note to Close On
You can implicitly test your private methods by making sure that conditions are met such that the code is called through the public interface. If the public interface does not call out to the private methods then that code is not providing any function and should be removed. In the example above there should be some effect that calling the private method should return ie: an object with an address. If there's not, for example the code emits an event in a private method, then you should start looking to decouple that so that it can be tested -- even in that example you would likely listen/subscribe to that event and would be able to test it that way. Decoupling leads to better testability and easier code maintenance later down the road as well.