Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: move JSX DOM types back to @vue/runtime-dom #7979

Merged
merged 12 commits into from
Mar 29, 2023
File renamed without changes.
7 changes: 5 additions & 2 deletions packages/vue/jsx-runtime/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { VNode, VNodeRef } from '@vue/runtime-dom'
import { IntrinsicElementAttributes } from './dom'
import type {
VNode,
VNodeRef,
IntrinsicElementAttributes
} from '@vue/runtime-dom/dist/runtime-dom'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be just @vue/runtime-dom right?


export type ReservedProps = {
key?: string | number | symbol
Expand Down
40 changes: 31 additions & 9 deletions packages/vue/jsx.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
// 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 type {
VNode,
VNodeRef,
IntrinsicElementAttributes
} from '@vue/runtime-dom/dist/runtime-dom'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here


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 {
namespace JSX {
interface Element extends JSXInternal.Element {}
interface ElementClass extends JSXInternal.ElementClass {}
interface ElementAttributesProperty
extends JSXInternal.ElementAttributesProperty {}
interface IntrinsicElements extends JSXInternal.IntrinsicElements {}
interface IntrinsicAttributes extends JSXInternal.IntrinsicAttributes {}
export interface Element extends VNode {}
export interface ElementClass {
$props: {}
}
export interface ElementAttributesProperty {
$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 {}