diff --git a/package.json b/package.json index ccdebeb4906..008b8762e34 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "size": "node scripts/build.js vue runtime-dom size-check -p -f global", "lint": "prettier --write --parser typescript \"packages/**/*.ts?(x)\"", "test": "node scripts/build.js vue -f global -d && jest", - "test-dts": "node scripts/build.js reactivity runtime-core runtime-dom -t -f esm && tsd", + "test-dts": "node scripts/build.js reactivity runtime-core runtime-dom -dt -f esm-bundler && tsd", "release": "node scripts/release.js", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", "dev-compiler": "npm-run-all --parallel \"dev template-explorer\" serve", diff --git a/packages/runtime-core/src/components/KeepAlive.ts b/packages/runtime-core/src/components/KeepAlive.ts index 78bb824f971..6587e91122c 100644 --- a/packages/runtime-core/src/components/KeepAlive.ts +++ b/packages/runtime-core/src/components/KeepAlive.ts @@ -7,7 +7,7 @@ import { LifecycleHooks, currentInstance } from '../component' -import { VNode, cloneVNode, isVNode } from '../vnode' +import { VNode, cloneVNode, isVNode, VNodeProps } from '../vnode' import { warn } from '../warning' import { onBeforeUnmount, injectHook, onUnmounted } from '../apiLifecycle' import { isString, isArray, ShapeFlags } from '@vue/shared' @@ -218,7 +218,7 @@ const KeepAliveImpl = { // also to avoid inline import() in generated d.ts files export const KeepAlive = (KeepAliveImpl as any) as { new (): { - $props: KeepAliveProps + $props: VNodeProps & KeepAliveProps } } diff --git a/packages/runtime-core/src/components/Portal.ts b/packages/runtime-core/src/components/Portal.ts index bbbaaad4c9d..c1e0e5dab87 100644 --- a/packages/runtime-core/src/components/Portal.ts +++ b/packages/runtime-core/src/components/Portal.ts @@ -1,7 +1,7 @@ import { ComponentInternalInstance } from '../component' import { SuspenseBoundary } from './Suspense' import { RendererInternals, MoveType } from '../renderer' -import { VNode, VNodeArrayChildren } from '../vnode' +import { VNode, VNodeArrayChildren, VNodeProps } from '../vnode' import { isString, ShapeFlags, PatchFlags } from '@vue/shared' import { warn } from '../warning' @@ -114,5 +114,5 @@ export const PortalImpl = { // Force-casted public typing for h and TSX props inference export const Portal = (PortalImpl as any) as { __isPortal: true - new (): { $props: PortalProps } + new (): { $props: VNodeProps & PortalProps } } diff --git a/packages/runtime-core/src/components/Suspense.ts b/packages/runtime-core/src/components/Suspense.ts index 56a4d5da383..d27c1f29f58 100644 --- a/packages/runtime-core/src/components/Suspense.ts +++ b/packages/runtime-core/src/components/Suspense.ts @@ -1,4 +1,4 @@ -import { VNode, normalizeVNode, VNodeChild } from '../vnode' +import { VNode, normalizeVNode, VNodeChild, VNodeProps } from '../vnode' import { isFunction, isArray, ShapeFlags } from '@vue/shared' import { ComponentInternalInstance, handleSetupResult } from '../component' import { Slots } from '../componentSlots' @@ -67,7 +67,7 @@ export const Suspense = ((__FEATURE_SUSPENSE__ ? SuspenseImpl : null) as any) as { __isSuspense: true - new (): { $props: SuspenseProps } + new (): { $props: VNodeProps & SuspenseProps } } function mountSuspense( diff --git a/rollup.config.js b/rollup.config.js index 18fc0e5aad5..ed3e5cd44cc 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -88,10 +88,7 @@ function createConfig(format, output, plugins = []) { output.name = packageOptions.name } - const shouldEmitDeclarations = - process.env.TYPES != null && - process.env.NODE_ENV === 'production' && - !hasTSChecked + const shouldEmitDeclarations = process.env.TYPES != null && !hasTSChecked const tsPlugin = ts({ check: process.env.NODE_ENV === 'production' && !hasTSChecked, diff --git a/test-dts/tsx.test-d.tsx b/test-dts/tsx.test-d.tsx index 387533739c9..8c63070e6b4 100644 --- a/test-dts/tsx.test-d.tsx +++ b/test-dts/tsx.test-d.tsx @@ -28,14 +28,17 @@ expectType() expectType() expectType() -// target is required +expectType() expectError() +expectError() // KeepAlive expectType() +expectType() expectError() // Suspense expectType() +expectType() expectType( {}} onRecede={() => {}} />) expectError()