TS4010

Type parameter 'T' of public static method from exported class has or is using private name 'StrategyState'.

Broken Code ❌

MyClass.mts
export class MyClass {
  public static printState<T extends State>(state: T) {
    console.log(state);
  }
}
State.mts
type State = {
  today: string;
  tomorrow: string;
};

Fixed Code ✔️

When using a type from another file, you have to make sure that it is exported and imported accordingly:

MyClass.mts
import { State } from './State.js';
 
export class MyClass {
  public static printState<T extends State>(state: T) {
    console.log(state);
  }
}
State.mts
export type State = {
  today: string;
  tomorrow: string;
};