我可以得到价值,但不能重新分配另一个;为什么?
export default class RemCpPluginHandler<
SourceType extends StdMap<string | number>
> extends StdFileBasedPluginHandler<StdMap<string | number>> {
constructor(configuration: CollectorConfiguration) {
super(configuration);
this.dataProcessor.recordPreProcessor.preprocessRecord = (
record: SourceType
) => {
const newCountry = record.COUNTRY.toString().replace(
/[0-9]*\. /gi,
""
);
record.COUNTRY = newCountry;
return record;
};
}
}在record.COUNTRY =newCountry中;我有一个错误:
属性'COUNTRY‘在' SourceType 'r> SourceType类型上不存在,扩展接口StdMap {key: string: T;}
发布于 2020-09-14 10:17:33
我通过更改输入参数的类型来解决问题:
record: SourceType至
record: {COUNTRY: string}仍不清楚编译器为什么抛出值分配错误。
https://stackoverflow.com/questions/63849917
复制相似问题