chore: remove property correct

This commit is contained in:
lawvs
2022-07-27 16:12:54 +08:00
parent 91781b4d75
commit 29d5a8c971
2 changed files with 3 additions and 4 deletions

View File

@@ -248,10 +248,8 @@ export const getRecastItemValue = (block: RecastItem | AsyncBlock) => {
}; };
const removeValue = (propertyId: RecastPropertyId) => { const removeValue = (propertyId: RecastPropertyId) => {
return recastItem.setProperty(TABLE_VALUES_KEY, { const { [propertyId]: omitted, ...restProps } = props;
...props, return recastItem.setProperty(TABLE_VALUES_KEY, restProps);
[propertyId]: null,
});
}; };
return { getAllValue, getValue, setValue, removeValue }; return { getAllValue, getValue, setValue, removeValue };
}; };

View File

@@ -18,6 +18,7 @@ type VariantBlock<Props> = Omit<
value: Props[T] value: Props[T]
): Promise<boolean>; ): Promise<boolean>;
setProperties(value: Partial<Props>): Promise<boolean>; setProperties(value: Partial<Props>): Promise<boolean>;
removeProperty<T extends keyof Props>(key: T): Promise<boolean>;
}; };
export type RecastBlock = VariantBlock<RecastDataProperties>; export type RecastBlock = VariantBlock<RecastDataProperties>;