Я создал код, который будет переопределять конфигурацию по умолчанию для класса, но я получаю странную ошибку Type 'IConfig' is not assignable to type 'import("/Volumes/D/www/js/tsc_1/test").IConfig'.ts(2322)
Я не могу присвоить ту же переменную TYPE другой переменной. пожалуйста, проверьте скриншоты
export default interface IPlugin {
setConfig<T>(config: T): T
}
export interface IConfig {
port: number
}
const _config: IConfig = {
port: 7001
}
class Server implements IPlugin {
public config : IConfig
constructor() {
this.config = _config
}
setConfig<IConfig>(configNew: IConfig) {
this.config = configNew
// ERROR - Type 'IConfig' is not assignable to type 'import("/Volumes/D/www/js/tsc_1/test").IConfig'.ts(2322)
return configNew
}
}
![enter image description here](https://i.stack.imgur.com/9jUVR.png)