this is my code. why this.settingData[key] type is never
?
enum InlineEnum {
auto,
manual,
close
}
interface DataType {
inlineType: InlineEnum;
localCodeRepo: boolean;
}
class Cla {
private settingData: DataType = {
inlineType: InlineEnum.auto,
localCodeRepo: false
}
setConfig(key: keyof DataType, value: InlineEnum | boolean) {
this.settingData[key] = value;
}
}
Type 'boolean | InlineEnum' is not assignable to type 'never'. Type 'boolean' is not assignable to type 'never'.ts(2322) (property) Cla.settingData: DataType
I have tried deleting ‘inlineType’ from settingData and there should be no such issue. It seems to be caused by ‘enum’. Can anyone know why?