Question: Get the instance type of a singleton class in TypeScript

I have a singleton class:
class Singleton {
  private static instance: Singleton;

  private constructor() {
    // Private constructor to prevent instantiation outside the class
  }

  public static getInstance(): Singleton {
    if (!Singleton.instance) {
      Singleton.instance = new Singleton();
    }
    return Singleton.instance;
  }

  someMethod(): void {
    console.log("Singleton method called");
  }
}

I know there is a type InstanceType, but it doesn't work with private constructors.
// Cannot assign a 'private' constructor type to a 'public' constructor type
type SingletonType = InstanceType<typeof Singleton>;

Is it possible to create a custom type that returns instance type of classes with private constructors?

EDIT
Well, I'll try to shed some light on the whole situation. I hope this clears up misunderstandings. As I wrote earlier I have a singleton class with a private constructor. I have to pass this singleton to constructor of another generic class as a parameter:
class BaseEntity<T extends typeof Singleton = typeof Singleton> {
    private singletonInstance: InstanceType<T>;
    
    constructor(instance: InstanceType<T>) {        
        this.singletonInstance = instance;        
    }
}

As far as Singleton class has a private constructor, I get an error Cannot assign a 'private' constructor type to a 'public' constructor type when trying to get its instance InstanceType<T>. So my question is, is it possible to create a custom generic type that accepts classes with "private" constructors and returns an instance type similar to "InstanceType"?


Answer:
TypeScript assumes that class constructors have a prototype property whose type is the same as the class instance type.  This isn't actually true in practice, since generally speaking class fields won't actually be present on the prototype.  But TypeScript makes that assumption as an approximation intentionally, and has declined suggestions to change this (see microsoft/TypeScript#11558 and microsoft/TypeScript#20922 for examples).
And so, if the InstanceType<T> utility type is unavailable to you because of a private constructor, you can get the same information by indexing into the constructor's type with "prototype":
type AlsoInstanceType<T extends { prototype: any }> =
  T["prototype"];

type SingletonType = AlsoInstanceType<typeof Singleton>
// type SingletonType = Singleton

class Foo { a = 1 }
type Example = AlsoInstanceType<typeof Foo>
// type Example = Foo;

And thus your BaseEntity can be written that way:
class BaseEntity<T extends typeof Singleton = typeof Singleton> {
  private singletonInstance: AlsoInstanceType<T>;

  constructor(instance: AlsoInstanceType<T>) {
    this.singletonInstance = instance;
  }
}


For Singleton in particular you could write ReturnType<typeof Singleton.getInstance> using the ReturnType<T> utility type:
type AlsoSingletonType = ReturnType<typeof Singleton.getInstance>;
// type AlsoSingletonType = Singleton

type SingletonInstance<T extends typeof Singleton> = ReturnType<T["getInstance"]>;
type AlsoAlsoSingletonType = SingletonInstance<typeof Singleton>;
// type AlsoAlsoSingletonType = Singleton

But T["prototype"] is more flexible.
Playground link to code