TS4010
Type parameter 'T' of public static method from exported class has or is using private name 'StrategyState'.
Broken Code ❌
export class MyClass {
public static printState<T extends State>(state: T) {
console.log(state);
}
}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:
import { State } from './State.js';
export class MyClass {
public static printState<T extends State>(state: T) {
console.log(state);
}
}export type State = {
today: string;
tomorrow: string;
};