Skip to content

Commit 49d4b31

Browse files
committed
feat: update type
1 parent 339fb4a commit 49d4b31

File tree

11 files changed

+30
-23
lines changed

11 files changed

+30
-23
lines changed

components/image/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ export type ImageProps = Partial<
1313
ExtractPropTypes<ReturnType<typeof imageProps>> &
1414
Omit<ImgHTMLAttributes, 'placeholder' | 'onClick'>
1515
>;
16-
const Image = defineComponent<ImageProps>({
16+
const Image = defineComponent({
1717
name: 'AImage',
1818
inheritAttrs: false,
19-
props: imageProps() as any,
19+
props: imageProps(),
2020
setup(props, { slots, attrs }) {
2121
const { prefixCls, rootPrefixCls, configProvider } = useConfigInject('image', props);
2222
// Style

components/message/useMessage.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ const Holder = defineComponent({
4747
'rtl',
4848
'transitionName',
4949
'onAllRemoved',
50-
] as any,
50+
'animation',
51+
'staticGetContainer',
52+
],
5153
setup(props, { expose }) {
5254
const { getPrefixCls, getPopupContainer } = useConfigInject('message', props);
5355

components/vc-image/src/Image.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export const imageProps = () => ({
3232
rootClassName: String,
3333
prefixCls: String,
3434
previewPrefixCls: String,
35+
width: [Number, String],
36+
height: [Number, String],
3537
previewMask: {
3638
type: [Boolean, Function] as PropType<false | (() => any)>,
3739
default: undefined,

components/vc-notification/Notification.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { getTransitionGroupProps } from '../_util/transition';
22
import type { Key, VueNode } from '../_util/type';
33
import type { CSSProperties } from 'vue';
44
import {
5+
toRaw,
56
shallowRef,
67
createVNode,
78
computed,
@@ -72,10 +73,10 @@ type NotificationState = {
7273
holderCallback?: HolderReadyCallback;
7374
}[];
7475

75-
const Notification = defineComponent<NotificationProps>({
76+
const Notification = defineComponent({
7677
name: 'Notification',
7778
inheritAttrs: false,
78-
props: ['prefixCls', 'transitionName', 'animation', 'maxCount', 'closeIcon', 'hashId'] as any,
79+
props: ['prefixCls', 'transitionName', 'animation', 'maxCount', 'closeIcon', 'hashId'],
7980
setup(props, { attrs, expose, slots }) {
8081
const hookRefs = new Map<Key, HTMLDivElement>();
8182
const notices = ref<NotificationState>([]);
@@ -125,7 +126,7 @@ const Notification = defineComponent<NotificationProps>({
125126
};
126127

127128
const remove = (removeKey: Key) => {
128-
notices.value = notices.value.filter(({ notice: { key, userPassKey } }) => {
129+
notices.value = toRaw(notices.value as any).filter(({ notice: { key, userPassKey } }) => {
129130
const mergedKey = userPassKey || key;
130131
return mergedKey !== removeKey;
131132
});

components/vc-overflow/Overflow.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,15 @@ const overflowProps = () => {
3939
/** When set to `full`, ssr will render full items by default and remove at client side */
4040
ssr: String as PropType<'full'>,
4141
onMousedown: Function as PropType<MouseEventHandler>,
42+
role: String,
4243
};
4344
};
4445
type InterOverflowProps = Partial<ExtractPropTypes<ReturnType<typeof overflowProps>>>;
4546
export type OverflowProps = HTMLAttributes & InterOverflowProps;
46-
const Overflow = defineComponent<OverflowProps>({
47+
const Overflow = defineComponent({
4748
name: 'Overflow',
4849
inheritAttrs: false,
49-
props: overflowProps() as any,
50+
props: overflowProps(),
5051
emits: ['visibleChange'],
5152
setup(props, { attrs, emit, slots }) {
5253
const fullySSR = computed(() => props.ssr === 'full');
@@ -331,6 +332,7 @@ const Overflow = defineComponent<OverflowProps>({
331332
class={classNames(!invalidate.value && prefixCls, className)}
332333
style={style}
333334
onMousedown={onMousedown}
335+
role={props.role}
334336
{...restAttrs}
335337
>
336338
{mergedData.value.map(internalRenderItemNode)}

components/vc-picker/panels/TimePanel/TimeUnitColumn.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ export type TimeUnitColumnProps = {
1818
onSelect?: (value: number) => void;
1919
};
2020

21-
export default defineComponent<TimeUnitColumnProps>({
21+
export default defineComponent({
2222
name: 'TimeUnitColumn',
23-
props: ['prefixCls', 'units', 'onSelect', 'value', 'active', 'hideDisabledOptions'] as any,
23+
props: ['prefixCls', 'units', 'onSelect', 'value', 'active', 'hideDisabledOptions'],
2424
setup(props) {
2525
const { open } = useInjectPanel();
2626

components/vc-table/Cell/index.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export interface CellProps<RecordType = DefaultRecordType> {
7777

7878
transformCellText?: TransformCellText<RecordType>;
7979
}
80-
export default defineComponent<CellProps>({
80+
export default defineComponent({
8181
name: 'Cell',
8282
props: [
8383
'prefixCls',
@@ -104,7 +104,7 @@ export default defineComponent<CellProps>({
104104
'column',
105105
'cellType',
106106
'transformCellText',
107-
] as any,
107+
],
108108
setup(props, { slots }) {
109109
const contextSlots = useInjectSlots();
110110
const { onHover, startRow, endRow } = useInjectHover();
@@ -318,7 +318,7 @@ export default defineComponent<CellProps>({
318318

319319
// ====================== Render ======================
320320
let title: string;
321-
const ellipsisConfig: CellEllipsisType = ellipsis === true ? { showTitle: true } : ellipsis;
321+
const ellipsisConfig = ellipsis === true ? { showTitle: true } : ellipsis;
322322
if (ellipsisConfig && (ellipsisConfig.showTitle || rowType === 'header')) {
323323
if (typeof childNode === 'string' || typeof childNode === 'number') {
324324
title = childNode.toString();

components/vc-table/Footer/Cell.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ export interface SummaryCellProps {
1212
align?: AlignType;
1313
}
1414

15-
export default defineComponent<SummaryCellProps>({
15+
export default defineComponent({
1616
name: 'ATableSummaryCell',
17-
props: ['index', 'colSpan', 'rowSpan', 'align'] as any,
17+
props: ['index', 'colSpan', 'rowSpan', 'align'],
1818
setup(props, { attrs, slots }) {
1919
const tableContext = useInjectTable();
2020
const summaryContext = useInjectSummary();

components/vc-table/Table.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export interface TableProps<RecordType = DefaultRecordType> {
149149
transformCellText?: TransformCellText<RecordType>;
150150
}
151151

152-
export default defineComponent<TableProps<DefaultRecordType>>({
152+
export default defineComponent({
153153
name: 'VcTable',
154154
inheritAttrs: false,
155155
props: [
@@ -191,7 +191,7 @@ export default defineComponent<TableProps<DefaultRecordType>>({
191191
'canExpandable',
192192
'onUpdateInternalRefs',
193193
'transformCellText',
194-
] as any,
194+
],
195195
emits: ['expand', 'expandedRowsChange', 'updateInternalRefs', 'update:expandedRowKeys'],
196196
setup(props, { attrs, slots, emit }) {
197197
const mergedData = computed(() => props.data || EMPTY_DATA);
@@ -271,7 +271,7 @@ export default defineComponent<TableProps<DefaultRecordType>>({
271271
// defalutXxxx 仅仅第一次生效
272272
stop();
273273

274-
const mergedExpandedKeys = computed(
274+
const mergedExpandedKeys = computed<Set<Key>>(
275275
() => new Set(props.expandedRowKeys || innerExpandedKeys.value || []),
276276
);
277277

@@ -282,9 +282,9 @@ export default defineComponent<TableProps<DefaultRecordType>>({
282282
const hasKey = mergedExpandedKeys.value.has(key);
283283
if (hasKey) {
284284
mergedExpandedKeys.value.delete(key);
285-
newExpandedKeys = [...mergedExpandedKeys.value];
285+
newExpandedKeys = [...(mergedExpandedKeys.value as any)];
286286
} else {
287-
newExpandedKeys = [...mergedExpandedKeys.value, key];
287+
newExpandedKeys = [...(mergedExpandedKeys.value as any), key];
288288
}
289289
innerExpandedKeys.value = newExpandedKeys;
290290

components/vc-table/hooks/useColumns.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function useColumns<RecordType>(
108108
prefixCls?: Ref<string>;
109109
columns?: Ref<ColumnsType<RecordType>>;
110110
expandable: Ref<boolean>;
111-
expandedKeys: Ref<Set<Key>>;
111+
expandedKeys: ComputedRef<Set<Key>>;
112112
getRowKey: Ref<GetRowKey<RecordType>>;
113113
onTriggerExpand: TriggerEventHandler<RecordType>;
114114
expandIcon?: Ref<RenderExpandIcon<RecordType>>;

components/vc-trigger/Popup/PopupInner.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,11 @@ export default defineComponent({
204204
class={mergedClassName}
205205
onMouseenter={onMouseenter}
206206
onMouseleave={onMouseleave}
207-
onMousedown={withModifiers(onMousedown, ['capture'])}
207+
onMousedown={withModifiers(onMousedown, ['capture'] as any)}
208208
{...{
209209
[supportsPassive ? 'onTouchstartPassive' : 'onTouchstart']: withModifiers(
210210
onTouchstart,
211-
['capture'],
211+
['capture'] as any,
212212
),
213213
}}
214214
style={mergedStyle}

0 commit comments

Comments
 (0)