Browse Source

fix: d.ts error

suzigang 3 years ago
parent
commit
2ca08853ed

+ 3 - 6
src/packages/__VUE/datepicker/index.vue

@@ -24,9 +24,6 @@ import { createComponent } from '@/packages/utils/create';
 import { padZero } from './utils';
 const { componentName, create, translate } = createComponent('datepicker');
 
-type Formatter = (type: string, option: PickerOption) => PickerOption;
-type Filter = (columnType: string, options: PickerOption[]) => PickerOption[];
-
 const currentYear = new Date().getFullYear();
 function isDate(val: Date): val is Date {
   return Object.prototype.toString.call(val) === '[object Date]' && !isNaN(val.getTime());
@@ -84,10 +81,10 @@ export default create({
       validator: isDate
     },
     formatter: {
-      type: Function as PropType<Formatter>,
+      type: Function as PropType<import('./type').Formatter>,
       default: null
     },
-    filter: Function as PropType<Filter>
+    filter: Function as PropType<import('./type').Filter>
   },
   emits: ['click', 'update:visible', 'change', 'confirm', 'update:moduleValue'],
 
@@ -112,7 +109,7 @@ export default create({
       return 32 - new Date(year, month - 1, 32).getDate();
     }
     const getBoundary = (type: string, value: Date) => {
-      const boundary = props[`${type}Date`];
+      const boundary = (props as any)[`${type}Date`];
       const year = boundary.getFullYear();
       let month = 1;
       let day = 1;

+ 1 - 1
src/packages/__VUE/dialog/index.vue

@@ -66,7 +66,7 @@ export default create({
       default: ''
     },
     content: {
-      type: [String, Object] as PropType<string | VNode>,
+      type: [String, Object] as PropType<string>,
       default: ''
     },
     noFooter: {

+ 3 - 3
src/packages/__VUE/grid/common.ts

@@ -1,5 +1,5 @@
 import { h, computed } from 'vue';
-import type { PropType, CSSProperties, ExtractPropTypes, SetupContext, RenderFunction } from 'vue';
+import type { ExtractPropTypes, SetupContext, RenderFunction } from 'vue';
 import { createComponent } from '@/packages/utils/create';
 import { pxCheck } from '@/packages/utils/pxCheck';
 import { useProvide } from '@/packages/utils/useRelation/useProvide';
@@ -52,7 +52,7 @@ export const gridProps = {
   },
   // 内容排列方向
   direction: {
-    type: String as PropType<GridDirection>
+    type: String as import('vue').PropType<GridDirection>
   },
   // 是否开启点击反馈
   clickable: {
@@ -77,7 +77,7 @@ export const component = {
     });
 
     const rootStyle = computed(() => {
-      const style: CSSProperties = {};
+      const style: import('vue').CSSProperties = {};
 
       if (props.gutter) {
         style.paddingLeft = pxCheck(props.gutter);

+ 2 - 7
src/packages/__VUE/menuitem/index.taro.vue

@@ -43,16 +43,11 @@ const { componentName, create } = createComponent('menu-item');
 import Icon from '../icon/index.taro.vue';
 import Popup from '../popup/index.taro.vue';
 
-type MenuItemOption = {
-  text: string;
-  value: number | string;
-};
-
 export default create({
   props: {
     title: String,
     options: {
-      type: Array as PropType<MenuItemOption[]>,
+      type: Array as PropType<import('./type').MenuItemOption[]>,
       default: []
     },
     disabled: {
@@ -133,7 +128,7 @@ export default create({
       return match ? match.text : '';
     };
 
-    const onClick = (option: MenuItemOption) => {
+    const onClick = (option: import('./type').MenuItemOption) => {
       state.showPopup = false;
       state.isShowPlaceholderElement = false;
 

+ 2 - 7
src/packages/__VUE/menuitem/index.vue

@@ -45,16 +45,11 @@ const { componentName, create } = createComponent('menu-item');
 import Icon from '../icon/index.vue';
 import Popup from '../popup/index.vue';
 
-type MenuItemOption = {
-  text: string;
-  value: number | string;
-};
-
 export default create({
   props: {
     title: String,
     options: {
-      type: Array as PropType<MenuItemOption[]>,
+      type: Array as PropType<import('./type').MenuItemOption[]>,
       default: []
     },
     disabled: {
@@ -135,7 +130,7 @@ export default create({
       return match ? match.text : '';
     };
 
-    const onClick = (option: MenuItemOption) => {
+    const onClick = (option: import('./type').MenuItemOption) => {
       state.showPopup = false;
       state.isShowPlaceholderElement = false;
 

+ 4 - 0
src/packages/__VUE/menuitem/type.ts

@@ -0,0 +1,4 @@
+export type MenuItemOption = {
+  text: string;
+  value: number | string;
+};

+ 4 - 5
src/packages/__VUE/skeleton/common.ts

@@ -1,5 +1,4 @@
-import { h, onMounted, CSSProperties } from 'vue';
-import { computed, PropType, toRefs } from 'vue';
+import { onMounted, computed, toRefs } from 'vue';
 export type avatarShape = 'round' | 'square';
 
 export const component = {
@@ -26,7 +25,7 @@ export const component = {
     },
     //头像形状:正方形/圆形
     avatarShape: {
-      type: String as PropType<avatarShape>,
+      type: String as import('vue').PropType<avatarShape>,
       default: 'round'
     },
     //头像大小
@@ -77,8 +76,8 @@ export const component = {
       };
     });
 
-    const getStyle = (): CSSProperties => {
-      const style: CSSProperties = {};
+    const getStyle = (): import('vue').CSSProperties => {
+      const style: import('vue').CSSProperties = {};
       if (avatarSize.value) {
         return {
           width: avatarSize.value,

+ 2 - 2
src/packages/__VUE/tabs/common.ts

@@ -1,5 +1,5 @@
 import { pxCheck } from '@/packages/utils/pxCheck';
-import { onMounted, provide, VNode, ref, Ref, computed, onActivated, watch, PropType } from 'vue';
+import { onMounted, provide, VNode, ref, Ref, computed, onActivated, watch } from 'vue';
 export class Title {
   title: string = '';
   titleSlot?: VNode[];
@@ -23,7 +23,7 @@ export const component = {
       default: 'horizontal' //vertical
     },
     size: {
-      type: String as PropType<TabsSize>,
+      type: String as import('vue').PropType<TabsSize>,
       default: 'normal'
     },
     type: {