Skip to content

Commit

Permalink
fix: ts type error
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjinzhou committed Nov 26, 2021
1 parent ddc3453 commit b20865f
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 44 deletions.
2 changes: 2 additions & 0 deletions components/mentions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import useConfigInject from '../_util/hooks/useConfigInject';
import { flattenChildren, getOptionProps } from '../_util/props-util';
import { useInjectFormItemContext } from '../form/FormItemContext';
import omit from '../_util/omit';
import { optionProps } from '../vc-mentions/src/Option';

interface MentionsConfig {
prefix?: string | string[];
Expand Down Expand Up @@ -209,6 +210,7 @@ const Mentions = defineComponent({
export const MentionsOption = defineComponent({
...Option,
name: 'AMentionsOption',
props: optionProps,
});

export default Object.assign(Mentions, {
Expand Down
6 changes: 5 additions & 1 deletion components/steps/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ const Steps = defineComponent({
});

/* istanbul ignore next */
export const Step = defineComponent({ ...VcStep, name: 'AStep', props: VcStepProps() });
export const Step = defineComponent({
...VcStep,
name: 'AStep',
props: VcStepProps(),
});
export default Object.assign(Steps, {
Step,
install: (app: App) => {
Expand Down
59 changes: 20 additions & 39 deletions components/table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,48 +14,13 @@ export type { TableProps, TablePaginationConfig };
const TableSummaryRow = defineComponent({ ...SummaryRow, name: 'ATableSummaryRow' });
const TableSummaryCell = defineComponent({ ...SummaryCell, name: 'ATableSummaryCell' });

const TempSummary = defineComponent({
...Summary,
const TableSummary = Object.assign(Summary, {
Cell: TableSummaryCell,
Row: TableSummaryRow,
name: 'ATableSummary',
});

const TableSummary = TempSummary as typeof TempSummary & {
Cell: typeof TableSummaryCell;
Row: typeof TableSummaryRow;
};
TableSummary.Cell = TableSummaryCell;
TableSummary.Row = TableSummaryRow;

const T = Table as typeof Table &
Plugin & {
Column: typeof Column;
ColumnGroup: typeof ColumnGroup;
Summary: typeof TableSummary;
SELECTION_ALL: typeof SELECTION_ALL;
SELECTION_INVERT: typeof SELECTION_INVERT;
SELECTION_NONE: typeof SELECTION_NONE;
};

T.SELECTION_ALL = SELECTION_ALL;
T.SELECTION_INVERT = SELECTION_INVERT;
T.SELECTION_NONE = SELECTION_NONE;

T.Column = Column;
T.ColumnGroup = ColumnGroup;

T.Summary = TableSummary;

/* istanbul ignore next */
T.install = function (app: App) {
app.component(TableSummary.name, TableSummary);
app.component(TableSummaryCell.name, TableSummaryCell);
app.component(TableSummaryRow.name, TableSummaryRow);
app.component(T.name, T);
app.component(T.Column.name, Column);
app.component(T.ColumnGroup.name, ColumnGroup);
return app;
};

export {
tableProps,
TableSummary,
Expand All @@ -65,4 +30,20 @@ export {
ColumnGroup as TableColumnGroup,
};

export default T;
export default Object.assign(Table, {
SELECTION_ALL,
SELECTION_INVERT,
SELECTION_NONE,
Column,
ColumnGroup,
Summary: TableSummary,
install: (app: App) => {
app.component(TableSummary.name, TableSummary);
app.component(TableSummaryCell.name, TableSummaryCell);
app.component(TableSummaryRow.name, TableSummaryRow);
app.component(Table.name, Table);
app.component(Column.name, Column);
app.component(ColumnGroup.name, ColumnGroup);
return app;
},
});
5 changes: 3 additions & 2 deletions components/tree/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { App } from 'vue';
import { defineComponent } from 'vue';
import Tree from './Tree';
import { TreeNode as VsTreeNode } from '../vc-tree';
import { TreeNode as VcTreeNode } from '../vc-tree';
import DirectoryTree from './DirectoryTree';
import { treeNodeProps } from '../vc-tree/props';

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

Expand All @@ -25,7 +26,7 @@ export type {

/* istanbul ignore next */

const TreeNode = defineComponent({ ...VsTreeNode, name: 'ATreeNode' });
const TreeNode = defineComponent({ ...VcTreeNode, name: 'ATreeNode', props: treeNodeProps });

export { DirectoryTree, TreeNode };

Expand Down
4 changes: 2 additions & 2 deletions components/vc-table/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export interface FooterProps<RecordType = DefaultRecordType> {
flattenColumns: FlattenColumns<RecordType>;
}

export default defineComponent({
export default defineComponent<FooterProps>({
name: 'Footer',
inheritAttrs: false,
props: ['stickyOffsets', 'flattenColumns'],
props: ['stickyOffsets', 'flattenColumns'] as any,
setup(props, { slots }) {
const tableContext = useInjectTable();
useProvideSummary(
Expand Down

0 comments on commit b20865f

Please sign in to comment.