Skip to content

Commit c36b69d

Browse files
committed
fix: ts error
1 parent 8e54318 commit c36b69d

File tree

11 files changed

+29
-23
lines changed

11 files changed

+29
-23
lines changed

components/form/FormItem.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@ import { toArray } from './utils/typeUtil';
2727
import { warning } from '../vc-util/warning';
2828
import find from 'lodash-es/find';
2929
import { tuple } from '../_util/type';
30-
import type { InternalNamePath, Rule, RuleError, RuleObject, ValidateOptions } from './interface';
30+
import type {
31+
FormLabelAlign,
32+
InternalNamePath,
33+
Rule,
34+
RuleError,
35+
RuleObject,
36+
ValidateOptions,
37+
} from './interface';
3138
import useConfigInject from '../_util/hooks/useConfigInject';
3239
import { useInjectForm } from './context';
3340
import FormItemLabel from './FormItemLabel';
@@ -90,7 +97,7 @@ export const formItemProps = () => ({
9097
wrapperCol: { type: Object as PropType<ColProps & HTMLAttributes> },
9198
hasFeedback: { type: Boolean, default: false },
9299
colon: { type: Boolean, default: undefined },
93-
labelAlign: PropTypes.oneOf(tuple('left', 'right')),
100+
labelAlign: String as PropType<FormLabelAlign>,
94101
prop: { type: [String, Number, Array] as PropType<string | number | Array<string | number>> },
95102
name: { type: [String, Number, Array] as PropType<string | number | Array<string | number>> },
96103
rules: [Array, Object] as PropType<Rule[] | Rule>,

components/mentions/index.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import type { App, PropType, ExtractPropTypes } from 'vue';
22
import { watch, ref, defineComponent } from 'vue';
33
import classNames from '../_util/classNames';
44
import PropTypes from '../_util/vue-types';
5-
import VcMentions, { Option } from '../vc-mentions';
5+
import VcMentions from '../vc-mentions';
66
import { mentionsProps as baseMentionsProps } from '../vc-mentions/src/mentionsProps';
77
import useConfigInject from '../_util/hooks/useConfigInject';
88
import { flattenChildren, getOptionProps } from '../_util/props-util';
99
import { useInjectFormItemContext } from '../form/FormItemContext';
1010
import omit from '../_util/omit';
11-
import { optionProps } from '../vc-mentions/src/Option';
11+
import { optionProps, optionOptions } from '../vc-mentions/src/Option';
1212
import type { KeyboardEventHandler } from '../_util/EventInterface';
1313

1414
interface MentionsConfig {
@@ -206,7 +206,7 @@ const Mentions = defineComponent({
206206
/* istanbul ignore next */
207207
export const MentionsOption = defineComponent({
208208
compatConfig: { MODE: 3 },
209-
...Option,
209+
...optionOptions,
210210
name: 'AMentionsOption',
211211
props: optionProps,
212212
});

components/table/index.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import Table, { tableProps } from './Table';
22
import Column from './Column';
33
import ColumnGroup from './ColumnGroup';
44
import type { TableProps, TablePaginationConfig } from './Table';
5-
import { defineComponent } from 'vue';
65
import type { App } from 'vue';
76
import { EXPAND_COLUMN, Summary, SummaryCell, SummaryRow } from '../vc-table';
87
import {
@@ -16,8 +15,8 @@ export type { ColumnProps } from './Column';
1615
export type { ColumnsType, ColumnType, ColumnGroupType } from './interface';
1716
export type { TableProps, TablePaginationConfig };
1817

19-
const TableSummaryRow = defineComponent({ ...SummaryRow, name: 'ATableSummaryRow' });
20-
const TableSummaryCell = defineComponent({ ...SummaryCell, name: 'ATableSummaryCell' });
18+
const TableSummaryRow = SummaryRow;
19+
const TableSummaryCell = SummaryCell;
2120

2221
const TableSummary = Object.assign(Summary, {
2322
Cell: TableSummaryCell,

components/tree/index.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import type { App } from 'vue';
2-
import { defineComponent } from 'vue';
32
import Tree from './Tree';
43
import { TreeNode as VcTreeNode } from '../vc-tree';
54
import DirectoryTree from './DirectoryTree';
6-
import { treeNodeProps } from '../vc-tree/props';
75

86
export type { EventDataNode, DataNode } from '../vc-tree/interface';
97

@@ -26,7 +24,7 @@ export type {
2624

2725
/* istanbul ignore next */
2826

29-
const TreeNode = defineComponent({ ...VcTreeNode, name: 'ATreeNode', props: treeNodeProps });
27+
const TreeNode = VcTreeNode;
3028

3129
export { DirectoryTree, TreeNode };
3230

components/upload/UploadList/ListItem.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ export const listItemProps = () => {
4545
onPreview: Function as PropType<(file: UploadFile, e: Event) => void>,
4646
onClose: Function as PropType<(file: UploadFile) => void>,
4747
onDownload: Function as PropType<(file: UploadFile) => void>,
48-
progress: Object as PropType<UploadListProgressProps>,
48+
progress: {
49+
type: Object as PropType<UploadListProgressProps>,
50+
default: undefined as UploadListProgressProps,
51+
},
4952
};
5053
};
5154

components/vc-mentions/src/Option.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ export const optionProps = {
88
};
99

1010
export type OptionProps = Partial<ExtractPropTypes<typeof optionProps>>;
11-
12-
export default defineComponent({
13-
compatConfig: { MODE: 3 },
11+
export const optionOptions = {
1412
name: 'Option',
1513
props: optionProps,
1614
render(_props: any, { slots }: any) {
1715
return slots.default?.();
1816
},
17+
};
18+
export default defineComponent({
19+
compatConfig: { MODE: 3 },
20+
...optionOptions,
1921
});

components/vc-table/Footer/Cell.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface SummaryCellProps {
1313
}
1414

1515
export default defineComponent<SummaryCellProps>({
16-
name: 'SummaryCell',
16+
name: 'ATableSummaryCell',
1717
props: ['index', 'colSpan', 'rowSpan', 'align'] as any,
1818
setup(props, { attrs, slots }) {
1919
const tableContext = useInjectTable();

components/vc-table/Footer/Row.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { defineComponent } from 'vue';
22

33
export default defineComponent({
44
compatConfig: { MODE: 3 },
5-
name: 'FooterRow',
5+
name: 'ATableSummaryRow',
66
setup(_props, { slots }) {
77
return () => <tr>{slots.default?.()}</tr>;
88
},

components/vc-tree/TreeNode.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const defaultTitle = '---';
2525

2626
export default defineComponent({
2727
compatConfig: { MODE: 3 },
28-
name: 'TreeNode',
28+
name: 'ATreeNode',
2929
inheritAttrs: false,
3030
props: treeNodeProps,
3131
isTreeNode: 1,
@@ -293,7 +293,7 @@ export default defineComponent({
293293
// ==================== Render: Drag Handler ====================
294294
const renderDragHandler = () => {
295295
const { draggable, prefixCls } = context.value;
296-
return draggable?.icon ? (
296+
return draggable && draggable?.icon ? (
297297
<span class={`${prefixCls}-draggable-icon`}>{draggable.icon}</span>
298298
) : null;
299299
};

components/vc-tree/contextTypes.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export interface TreeContextProps {
4040
showIcon: boolean;
4141
icon: IconType;
4242
switcherIcon: IconType;
43-
draggable: DraggableConfig;
43+
draggable: DraggableConfig | false;
4444
draggingNodeKey?: Key;
4545
checkable: boolean;
4646
customCheckable: () => any;

site/src/utils/util.js

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
export function isZhCN(name) {
22
return /-cn\/?$/.test(name);
33
}
4-
54
export function isLocalStorageNameSupported() {
65
const testKey = 'test';
76
const storage = window.localStorage;
@@ -13,7 +12,6 @@ export function isLocalStorageNameSupported() {
1312
return false;
1413
}
1514
}
16-
1715
export function getLocalizedPathname(path, zhCN, query = {}, hash) {
1816
const pathname = path.startsWith('/') ? path : `/${path}`;
1917
let fullPath;
@@ -27,7 +25,6 @@ export function getLocalizedPathname(path, zhCN, query = {}, hash) {
2725
} else {
2826
fullPath = `${pathname}-cn`;
2927
}
30-
3128
if (hash) {
3229
const localHash = hash[zhCN ? 'zhCN' : 'enUS'];
3330
fullPath += `#${localHash}`;

0 commit comments

Comments
 (0)