File tree Expand file tree Collapse file tree 4 files changed +20
-3
lines changed Expand file tree Collapse file tree 4 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 44 createVNode ,
55 VNodeArrayChildren ,
66 Fragment ,
7+ Text ,
8+ Comment ,
79 isVNode
810} from './vnode'
911import { Teleport , TeleportProps } from './components/Teleport'
@@ -84,6 +86,16 @@ export function h(
8486 children ?: RawChildren | RawSlots
8587) : VNode
8688
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
8799// fragment
88100export function h ( type : typeof Fragment , children ?: VNodeArrayChildren ) : VNode
89101export function h (
Original file line number Diff line number Diff line change 2626// Kanitkorn Sujautra <https://github.com/lukyth>
2727// Sebastian Silbermann <https://github.com/eps1lon>
2828
29+ import { VNode } from '@vue/runtime-core'
2930import * as CSS from 'csstype'
3031
3132export interface CSSProperties extends CSS . Properties < string | number > {
@@ -1338,7 +1339,7 @@ type NativeElements = {
13381339
13391340declare global {
13401341 namespace JSX {
1341- interface Element { }
1342+ interface Element extends VNode { }
13421343 interface ElementClass {
13431344 $props : { }
13441345 }
Original file line number Diff line number Diff line change 11import {
2+ h ,
3+ Text ,
24 FunctionalComponent ,
35 expectError ,
46 expectType ,
57 Component
68} from './index'
79
810// simple function signature
9- const Foo = ( props : { foo : number } ) => props . foo
11+ const Foo = ( props : { foo : number } ) => h ( Text , null , props . foo )
1012
1113// TSX
1214expectType < JSX . Element > ( < Foo foo = { 1 } /> )
Original file line number Diff line number Diff line change @@ -5,9 +5,11 @@ import {
55 Fragment ,
66 Teleport ,
77 expectError ,
8- expectType
8+ expectType ,
9+ VNode
910} from './index'
1011
12+ expectType < VNode > ( < div /> )
1113expectType < JSX . Element > ( < div /> )
1214expectType < JSX . Element > ( < div id = "foo" /> )
1315expectType < JSX . Element > ( < input value = "foo" /> )
You can’t perform that action at this time.
0 commit comments