types: setup tests for built d.ts files
This commit is contained in:
12
packages/runtime-core/jsx.d.ts
vendored
12
packages/runtime-core/jsx.d.ts
vendored
@@ -1,12 +0,0 @@
|
||||
declare namespace JSX {
|
||||
interface Element {}
|
||||
interface ElementClass {
|
||||
$props: {}
|
||||
}
|
||||
interface ElementAttributesProperty {
|
||||
$props: {}
|
||||
}
|
||||
interface IntrinsicElements {
|
||||
[name: string]: any
|
||||
}
|
||||
}
|
||||
@@ -69,6 +69,11 @@ export interface ComponentOptionsBase<
|
||||
// type-only differentiator to separate OptionWihtoutProps from a constructor
|
||||
// type returned by createComponent() or FunctionalComponent
|
||||
call?: never
|
||||
// type-only differentiators for built-in Vnode types
|
||||
__isFragment?: never
|
||||
__isPortal?: never
|
||||
__isSuspense?: never
|
||||
__isKeepAlive?: never
|
||||
}
|
||||
|
||||
export type ComponentOptionsWithoutProps<
|
||||
|
||||
@@ -342,7 +342,8 @@ type CompileFunction = (
|
||||
|
||||
let compile: CompileFunction | undefined
|
||||
|
||||
export function registerRuntimeCompiler(_compile: CompileFunction) {
|
||||
// exported method uses any to avoid d.ts relying on the compiler types.
|
||||
export function registerRuntimeCompiler(_compile: any) {
|
||||
compile = _compile
|
||||
}
|
||||
|
||||
|
||||
@@ -81,20 +81,19 @@ export function h(
|
||||
children?: RawChildren
|
||||
): VNode
|
||||
|
||||
// keyed fragment
|
||||
export function h(type: typeof Fragment, children?: RawChildren): VNode
|
||||
// fragment
|
||||
export function h(type: typeof Fragment, children?: VNodeChildren): VNode
|
||||
export function h(
|
||||
type: typeof Fragment,
|
||||
props?: (RawProps & { key?: string | number }) | null,
|
||||
children?: RawChildren
|
||||
props?: RawProps | null,
|
||||
children?: VNodeChildren
|
||||
): VNode
|
||||
|
||||
// portal
|
||||
export function h(type: typeof Portal, children?: RawChildren): VNode
|
||||
// portal (target prop is required)
|
||||
export function h(
|
||||
type: typeof Portal,
|
||||
props?: (RawProps & { target: any }) | null,
|
||||
children?: RawChildren
|
||||
props: RawProps & { target: any },
|
||||
children: RawChildren
|
||||
): VNode
|
||||
|
||||
// suspense
|
||||
@@ -114,25 +113,22 @@ export function h(
|
||||
export function h(type: FunctionalComponent, children?: RawChildren): VNode
|
||||
export function h<P>(
|
||||
type: FunctionalComponent<P>,
|
||||
props?: (RawProps & P) | null,
|
||||
props?: (RawProps & P) | ({} extends P ? null : never),
|
||||
children?: RawChildren | RawSlots
|
||||
): VNode
|
||||
|
||||
// stateful component
|
||||
export function h(type: ComponentOptions, children?: RawChildren): VNode
|
||||
export function h<P>(
|
||||
type: ComponentOptionsWithoutProps<P>,
|
||||
props?: (RawProps & P) | null,
|
||||
children?: RawChildren | RawSlots
|
||||
): VNode
|
||||
export function h<P extends string>(
|
||||
type: ComponentOptionsWithArrayProps<P>,
|
||||
export function h(
|
||||
type: ComponentOptionsWithoutProps | ComponentOptionsWithArrayProps,
|
||||
props?: RawProps | null,
|
||||
children?: RawChildren | RawSlots
|
||||
): VNode
|
||||
export function h<P>(
|
||||
type: ComponentOptionsWithObjectProps<P>,
|
||||
props?: (RawProps & ExtractPropTypes<P>) | null,
|
||||
export function h<O>(
|
||||
type: ComponentOptionsWithObjectProps<O>,
|
||||
props?:
|
||||
| (RawProps & ExtractPropTypes<O>)
|
||||
| ({} extends ExtractPropTypes<O> ? null : never),
|
||||
children?: RawChildren | RawSlots
|
||||
): VNode
|
||||
|
||||
@@ -140,7 +136,7 @@ export function h<P>(
|
||||
export function h(type: Constructor, children?: RawChildren): VNode
|
||||
export function h<P>(
|
||||
type: Constructor<P>,
|
||||
props?: (RawProps & P) | null,
|
||||
props?: (RawProps & P) | ({} extends P ? null : never),
|
||||
children?: RawChildren | RawSlots
|
||||
): VNode
|
||||
|
||||
|
||||
@@ -20,8 +20,14 @@ import { SuspenseBoundary, isSuspenseType } from './suspense'
|
||||
import { DirectiveBinding } from './directives'
|
||||
import { SuspenseImpl } from './suspense'
|
||||
|
||||
export const Fragment = Symbol(__DEV__ ? 'Fragment' : undefined)
|
||||
export const Portal = Symbol(__DEV__ ? 'Portal' : undefined)
|
||||
export const Fragment = (Symbol(__DEV__ ? 'Fragment' : undefined) as any) as {
|
||||
// type differentiator for h()
|
||||
__isFragment: true
|
||||
}
|
||||
export const Portal = (Symbol(__DEV__ ? 'Portal' : undefined) as any) as {
|
||||
// type differentiator for h()
|
||||
__isPortal: true
|
||||
}
|
||||
export const Text = Symbol(__DEV__ ? 'Text' : undefined)
|
||||
export const Comment = Symbol(__DEV__ ? 'Comment' : undefined)
|
||||
|
||||
@@ -47,7 +53,7 @@ export type VNodeTypes =
|
||||
export interface VNodeProps {
|
||||
[key: string]: any
|
||||
key?: string | number
|
||||
ref?: string | Ref | Function
|
||||
ref?: string | Ref | ((ref: object) => void)
|
||||
}
|
||||
|
||||
type VNodeChildAtom<HostNode, HostElement> =
|
||||
|
||||
Reference in New Issue
Block a user