问题描述
这是我在这里的第一个问题! 首先,我面临使用运动覆盆子pi 4保存图像文件大小的问题。 我想做的是将保存的图片发送到Line Notify,以便能够在手机上看到。要发送的文件大小应小于3MB。图像保存为3.6 MiB(3825915字节)。
这是我收到的消息。
// construct a type that is the union of all possible generic subsitution
type ConfigUnion = {
[Key in TheEnum]: Config<Key>;
}[TheEnum];
function caller(configArr: Config<TheEnum>[]) {
configArr.map((currentConfig: Config<TheEnum>) => {
const currentGetter = getterMap[currentConfig.key] as any;
const newParams = currentGetter(currentConfig.params) as ConfigUnion;
// now TypeScript can discriminate the actual type based on its key.
if (newParams.key == TheEnum.Foo) {
newParams.params.a // OK
newParams.params.z // not OK
}
if (newParams.key == TheEnum.Bar) {
newParams.params.z // OK
}
})
}
如果有人知道,请帮助我。 谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)