Skip to content

Commit 347f69f

Browse files
committed
fix: empty type
1 parent 8cb7c65 commit 347f69f

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

components/empty/index.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CSSProperties, VNodeTypes, inject, App, SetupContext } from 'vue';
1+
import { CSSProperties, VNodeTypes, inject, App, SetupContext, FunctionalComponent } from 'vue';
22
import classNames from '../_util/classNames';
33
import { defaultConfigProvider, ConfigConsumerProps } from '../config-provider';
44
import LocaleReceiver from '../locale-provider/LocaleReceiver';
@@ -20,10 +20,16 @@ export interface EmptyProps {
2020
imageStyle?: CSSProperties;
2121
image?: VNodeTypes | null;
2222
description?: VNodeTypes;
23-
children?: VNodeTypes;
2423
}
2524

26-
const Empty = (props: EmptyProps, { slots }: SetupContext) => {
25+
interface EmptyType extends FunctionalComponent<EmptyProps> {
26+
displayName: string;
27+
PRESENTED_IMAGE_DEFAULT: VNodeTypes;
28+
PRESENTED_IMAGE_SIMPLE: VNodeTypes;
29+
install: (app: App) => void;
30+
}
31+
32+
const Empty: EmptyType = (props: EmptyProps, { slots }: SetupContext) => {
2733
const configProvider = inject<ConfigConsumerProps>('configProvider', defaultConfigProvider);
2834
const { getPrefixCls, direction } = configProvider;
2935
const {

examples/App.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
1-
import { defaultTo } from 'lodash-es';
21
import Empty from '../components/empty';
32
import '../components/empty/style';
43

4+
type TypeName<T> = T extends string
5+
? 'string'
6+
: T extends number
7+
? 'number'
8+
: T extends boolean
9+
? 'boolean'
10+
: T extends undefined
11+
? 'undefined'
12+
: T extends Function
13+
? 'function'
14+
: 'object';
15+
16+
type T10 = TypeName<string | (() => void)>;
17+
518
export default {
619
render() {
720
return <Empty />;

0 commit comments

Comments
 (0)