types: fix tsx dts tests
This commit is contained in:
parent
57ee5df364
commit
77103e1fd7
@ -10,7 +10,7 @@
|
|||||||
"size": "node scripts/build.js vue runtime-dom size-check -p -f global",
|
"size": "node scripts/build.js vue runtime-dom size-check -p -f global",
|
||||||
"lint": "prettier --write --parser typescript \"packages/**/*.ts?(x)\"",
|
"lint": "prettier --write --parser typescript \"packages/**/*.ts?(x)\"",
|
||||||
"test": "node scripts/build.js vue -f global -d && jest",
|
"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",
|
"release": "node scripts/release.js",
|
||||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
||||||
"dev-compiler": "npm-run-all --parallel \"dev template-explorer\" serve",
|
"dev-compiler": "npm-run-all --parallel \"dev template-explorer\" serve",
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
LifecycleHooks,
|
LifecycleHooks,
|
||||||
currentInstance
|
currentInstance
|
||||||
} from '../component'
|
} from '../component'
|
||||||
import { VNode, cloneVNode, isVNode } from '../vnode'
|
import { VNode, cloneVNode, isVNode, VNodeProps } from '../vnode'
|
||||||
import { warn } from '../warning'
|
import { warn } from '../warning'
|
||||||
import { onBeforeUnmount, injectHook, onUnmounted } from '../apiLifecycle'
|
import { onBeforeUnmount, injectHook, onUnmounted } from '../apiLifecycle'
|
||||||
import { isString, isArray, ShapeFlags } from '@vue/shared'
|
import { isString, isArray, ShapeFlags } from '@vue/shared'
|
||||||
@ -218,7 +218,7 @@ const KeepAliveImpl = {
|
|||||||
// also to avoid inline import() in generated d.ts files
|
// also to avoid inline import() in generated d.ts files
|
||||||
export const KeepAlive = (KeepAliveImpl as any) as {
|
export const KeepAlive = (KeepAliveImpl as any) as {
|
||||||
new (): {
|
new (): {
|
||||||
$props: KeepAliveProps
|
$props: VNodeProps & KeepAliveProps
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { ComponentInternalInstance } from '../component'
|
import { ComponentInternalInstance } from '../component'
|
||||||
import { SuspenseBoundary } from './Suspense'
|
import { SuspenseBoundary } from './Suspense'
|
||||||
import { RendererInternals, MoveType } from '../renderer'
|
import { RendererInternals, MoveType } from '../renderer'
|
||||||
import { VNode, VNodeArrayChildren } from '../vnode'
|
import { VNode, VNodeArrayChildren, VNodeProps } from '../vnode'
|
||||||
import { isString, ShapeFlags, PatchFlags } from '@vue/shared'
|
import { isString, ShapeFlags, PatchFlags } from '@vue/shared'
|
||||||
import { warn } from '../warning'
|
import { warn } from '../warning'
|
||||||
|
|
||||||
@ -114,5 +114,5 @@ export const PortalImpl = {
|
|||||||
// Force-casted public typing for h and TSX props inference
|
// Force-casted public typing for h and TSX props inference
|
||||||
export const Portal = (PortalImpl as any) as {
|
export const Portal = (PortalImpl as any) as {
|
||||||
__isPortal: true
|
__isPortal: true
|
||||||
new (): { $props: PortalProps }
|
new (): { $props: VNodeProps & PortalProps }
|
||||||
}
|
}
|
||||||
|
@ -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 { isFunction, isArray, ShapeFlags } from '@vue/shared'
|
||||||
import { ComponentInternalInstance, handleSetupResult } from '../component'
|
import { ComponentInternalInstance, handleSetupResult } from '../component'
|
||||||
import { Slots } from '../componentSlots'
|
import { Slots } from '../componentSlots'
|
||||||
@ -67,7 +67,7 @@ export const Suspense = ((__FEATURE_SUSPENSE__
|
|||||||
? SuspenseImpl
|
? SuspenseImpl
|
||||||
: null) as any) as {
|
: null) as any) as {
|
||||||
__isSuspense: true
|
__isSuspense: true
|
||||||
new (): { $props: SuspenseProps }
|
new (): { $props: VNodeProps & SuspenseProps }
|
||||||
}
|
}
|
||||||
|
|
||||||
function mountSuspense(
|
function mountSuspense(
|
||||||
|
@ -88,10 +88,7 @@ function createConfig(format, output, plugins = []) {
|
|||||||
output.name = packageOptions.name
|
output.name = packageOptions.name
|
||||||
}
|
}
|
||||||
|
|
||||||
const shouldEmitDeclarations =
|
const shouldEmitDeclarations = process.env.TYPES != null && !hasTSChecked
|
||||||
process.env.TYPES != null &&
|
|
||||||
process.env.NODE_ENV === 'production' &&
|
|
||||||
!hasTSChecked
|
|
||||||
|
|
||||||
const tsPlugin = ts({
|
const tsPlugin = ts({
|
||||||
check: process.env.NODE_ENV === 'production' && !hasTSChecked,
|
check: process.env.NODE_ENV === 'production' && !hasTSChecked,
|
||||||
|
@ -28,14 +28,17 @@ expectType<JSX.Element>(<Fragment />)
|
|||||||
expectType<JSX.Element>(<Fragment key="1" />)
|
expectType<JSX.Element>(<Fragment key="1" />)
|
||||||
|
|
||||||
expectType<JSX.Element>(<Portal target="#foo" />)
|
expectType<JSX.Element>(<Portal target="#foo" />)
|
||||||
// target is required
|
expectType<JSX.Element>(<Portal target="#foo" key="1" />)
|
||||||
expectError(<Portal />)
|
expectError(<Portal />)
|
||||||
|
expectError(<Portal target={1} />)
|
||||||
|
|
||||||
// KeepAlive
|
// KeepAlive
|
||||||
expectType<JSX.Element>(<KeepAlive include="foo" exclude={['a']} />)
|
expectType<JSX.Element>(<KeepAlive include="foo" exclude={['a']} />)
|
||||||
|
expectType<JSX.Element>(<KeepAlive key="1" />)
|
||||||
expectError(<KeepAlive include={123} />)
|
expectError(<KeepAlive include={123} />)
|
||||||
|
|
||||||
// Suspense
|
// Suspense
|
||||||
expectType<JSX.Element>(<Suspense />)
|
expectType<JSX.Element>(<Suspense />)
|
||||||
|
expectType<JSX.Element>(<Suspense key="1" />)
|
||||||
expectType<JSX.Element>(<Suspense onResolve={() => {}} onRecede={() => {}} />)
|
expectType<JSX.Element>(<Suspense onResolve={() => {}} onRecede={() => {}} />)
|
||||||
expectError(<Suspense onResolve={123} />)
|
expectError(<Suspense onResolve={123} />)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user