TS4075

error TS4075: Parameter ‘event’ of method from exported interface has or is using private name ‘Strategy’.

Broken Code ❌

1
2
3
4
5
6
7
8
9
10
11
export interface Strategy<SpecificConfig extends StrategyConfig> {
on(event: Strategy.TOPIC.TRADER_DELETE, listener: () => void): this;
}

export abstract class Strategy<SpecificConfig extends StrategyConfig> extends EventEmitter {
static readonly TOPIC = {
TRADER_DELETE: 'TRADER_DELETE',
};

// ...
}

Fixed Code ✔️

1
2
3
4
5
6
7
8
9
10
11
12
13
enum TOPIC {
TRADER_DELETE = 'TRADER_DELETE',
}

export interface Strategy<SpecificConfig extends StrategyConfig> {
on(event: TOPIC.TRADER_DELETE, listener: () => void): this;
}

export abstract class Strategy<SpecificConfig extends StrategyConfig> extends EventEmitter {
static readonly TOPIC = TOPIC;

// ...
}