File tree 4 files changed +20
-3
lines changed
4 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 4
4
createVNode ,
5
5
VNodeArrayChildren ,
6
6
Fragment ,
7
+ Text ,
8
+ Comment ,
7
9
isVNode
8
10
} from './vnode'
9
11
import { Teleport , TeleportProps } from './components/Teleport'
@@ -84,6 +86,16 @@ export function h(
84
86
children ?: RawChildren | RawSlots
85
87
) : VNode
86
88
89
+ // text/comment
90
+ export function h (
91
+ type : typeof Text | typeof Comment ,
92
+ children ?: string | number | boolean
93
+ ) : VNode
94
+ export function h (
95
+ type : typeof Text | typeof Comment ,
96
+ props ?: null ,
97
+ children ?: string | number | boolean
98
+ ) : VNode
87
99
// fragment
88
100
export function h ( type : typeof Fragment , children ?: VNodeArrayChildren ) : VNode
89
101
export function h (
Original file line number Diff line number Diff line change 26
26
// Kanitkorn Sujautra <https://github.com/lukyth>
27
27
// Sebastian Silbermann <https://github.com/eps1lon>
28
28
29
+ import { VNode } from '@vue/runtime-core'
29
30
import * as CSS from 'csstype'
30
31
31
32
export interface CSSProperties extends CSS . Properties < string | number > {
@@ -1338,7 +1339,7 @@ type NativeElements = {
1338
1339
1339
1340
declare global {
1340
1341
namespace JSX {
1341
- interface Element { }
1342
+ interface Element extends VNode { }
1342
1343
interface ElementClass {
1343
1344
$props : { }
1344
1345
}
Original file line number Diff line number Diff line change 1
1
import {
2
+ h ,
3
+ Text ,
2
4
FunctionalComponent ,
3
5
expectError ,
4
6
expectType ,
5
7
Component
6
8
} from './index'
7
9
8
10
// simple function signature
9
- const Foo = ( props : { foo : number } ) => props . foo
11
+ const Foo = ( props : { foo : number } ) => h ( Text , null , props . foo )
10
12
11
13
// TSX
12
14
expectType < JSX . Element > ( < Foo foo = { 1 } /> )
Original file line number Diff line number Diff line change @@ -5,9 +5,11 @@ import {
5
5
Fragment ,
6
6
Teleport ,
7
7
expectError ,
8
- expectType
8
+ expectType ,
9
+ VNode
9
10
} from './index'
10
11
12
+ expectType < VNode > ( < div /> )
11
13
expectType < JSX . Element > ( < div /> )
12
14
expectType < JSX . Element > ( < div id = "foo" /> )
13
15
expectType < JSX . Element > ( < input value = "foo" /> )
You can’t perform that action at this time.
0 commit comments