Skip to content

Commit

Permalink
types: register jsx types in runtime-dom to avoid breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
znck committed Nov 11, 2022
1 parent 0ce86c2 commit f1f9527
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/runtime-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-dom#readme",
"dependencies": {
"@vue/jsx": "3.2.44",
"@vue/shared": "3.2.44",
"@vue/runtime-core": "3.2.44",
"csstype": "^2.6.8"
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-dom/types/jsx.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {}
import '@vue/jsx/register'
2 changes: 2 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion test-dts/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// This directory contains a number of d.ts assertions
// use \@ts-expect-error where errors are expected.

import '../packages/jsx/register'
export * from '@vue/runtime-dom'

export function describe(_name: string, _fn: () => void): void
Expand All @@ -18,3 +17,18 @@ export type IsUnion<T, U extends T = T> = (
: true

export type IsAny<T> = 0 extends 1 & T ? true : false

import { h } from '@vue/jsx'
// Duplicating @vue/jsx/register here to be able to run dts tests
// without building types.
declare global {
namespace JSX {
interface Element extends h.JSX.Element {}
interface ElementClass extends h.JSX.ElementClass {}
interface ElementAttributesProperty
extends h.JSX.ElementAttributesProperty {}
interface IntrinsicElements extends h.JSX.IntrinsicElements {}
interface IntrinsicAttributes extends h.JSX.IntrinsicAttributes {}
interface ElementChildrenAttribute extends h.JSX.ElementChildrenAttribute {}
}
}

0 comments on commit f1f9527

Please sign in to comment.