1
1
import {
2
2
h ,
3
+ Component ,
4
+ ComponentOptions ,
3
5
RenderFunction ,
4
6
Fragment ,
5
7
SetupContext ,
6
8
VNodeChild ,
7
9
VNodeArrayChildren
8
10
} from 'vue'
9
11
import { NumberOptions , DateTimeOptions } from '../core'
10
- import { isString , isPlainObject , isArray } from '../utils'
12
+ import { isString , isObject , isArray } from '../utils'
11
13
import { BaseFormatProps } from './base'
12
14
13
15
export interface FormattableProps < Value , Format > extends BaseFormatProps {
@@ -45,7 +47,7 @@ export function renderFormatter<
45
47
46
48
if ( isString ( props . format ) ) {
47
49
options . key = props . format
48
- } else if ( isPlainObject ( props . format ) ) {
50
+ } else if ( isObject ( props . format ) ) {
49
51
// eslint-disable-next-line @typescript-eslint/no-explicit-any
50
52
if ( isString ( ( props . format as any ) . key ) ) {
51
53
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -72,8 +74,11 @@ export function renderFormatter<
72
74
children = [ parts ]
73
75
}
74
76
75
- return props . tag
77
+ // prettier-ignore
78
+ return isString ( props . tag )
76
79
? h ( props . tag , { ...attrs } , children )
77
- : h ( Fragment , { ...attrs } , children )
80
+ : isObject ( props . tag )
81
+ ? h ( props . tag as Component | ComponentOptions , { ...attrs } , children )
82
+ : h ( Fragment , { ...attrs } , children )
78
83
}
79
84
}
0 commit comments