forked from vuejs/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(types/jsx): jsx-runtime types for global JSX namespace registrati…
…on (vuejs#7978)
- Loading branch information
1 parent
6017a66
commit 5f0e7ab
Showing
2 changed files
with
32 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,36 @@ | ||
// 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 { | ||
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 {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters