mirror of https://github.com/vuejs/core.git
fix(types/jsx): jsx-runtime types for global JSX namespace registration (#7978)
This commit is contained in:
parent
77686cf476
commit
0f73f394da
|
|
@ -1,15 +1,36 @@
|
||||||
// global JSX namespace registration
|
// global JSX namespace registration
|
||||||
import { JSX as JSXInternal } from './jsx-runtime'
|
// somehow we have to copy=pase the jsx-runtime types here to make TypeScript happy
|
||||||
|
import { VNode, VNodeRef } from '@vue/runtime-dom'
|
||||||
|
import { IntrinsicElementAttributes } from './jsx-runtime/dom'
|
||||||
|
|
||||||
|
export * from './jsx-runtime/dom'
|
||||||
|
|
||||||
|
export type ReservedProps = {
|
||||||
|
key?: string | number | symbol
|
||||||
|
ref?: VNodeRef
|
||||||
|
ref_for?: boolean
|
||||||
|
ref_key?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type NativeElements = {
|
||||||
|
[K in keyof IntrinsicElementAttributes]: IntrinsicElementAttributes[K] &
|
||||||
|
ReservedProps
|
||||||
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
namespace JSX {
|
namespace JSX {
|
||||||
interface Element extends JSXInternal.Element {}
|
export interface Element extends VNode {}
|
||||||
interface ElementClass extends JSXInternal.ElementClass {}
|
export interface ElementClass {
|
||||||
interface ElementAttributesProperty
|
$props: {}
|
||||||
extends JSXInternal.ElementAttributesProperty {}
|
}
|
||||||
interface IntrinsicElements extends JSXInternal.IntrinsicElements {}
|
export interface ElementAttributesProperty {
|
||||||
interface IntrinsicAttributes extends JSXInternal.IntrinsicAttributes {}
|
$props: {}
|
||||||
|
}
|
||||||
|
export interface IntrinsicElements extends NativeElements {
|
||||||
|
// allow arbitrary elements
|
||||||
|
// @ts-ignore suppress ts:2374 = Duplicate string index signature.
|
||||||
|
[name: string]: any
|
||||||
|
}
|
||||||
|
export interface IntrinsicAttributes extends ReservedProps {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export {}
|
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,5 @@
|
||||||
// imports the global JSX namespace registration for compat.
|
// imports the global JSX namespace registration for compat.
|
||||||
// TODO: remove in 3.4
|
// TODO: remove in 3.4
|
||||||
import '../jsx'
|
import '../jsx'
|
||||||
|
|
||||||
|
export * from '../jsx-runtime/dom'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue