Преглед изворни кода

fix:提取AttrType类型

MTrun пре 3 година
родитељ
комит
f91b1d7f8a
1 измењених фајлова са 3 додато и 1 уклоњено
  1. 3 1
      src/views/chart/ContentEdit/hooks/useStyle.hook.ts

+ 3 - 1
src/views/chart/ContentEdit/hooks/useStyle.hook.ts

@@ -1,5 +1,7 @@
 import { PublicConfigType } from '@/packages/index.d'
-type AttrType = Pick<PublicConfigType, 'attr'>['attr']
+
+type PickPublicConfigType<T extends keyof PublicConfigType> = Pick<PublicConfigType, T>[T]
+type AttrType = PickPublicConfigType<'attr'>
 
 export const useComponentStyle = (attr: AttrType, index: number) => {
   const componentStyle = {