types: fix dts

This commit is contained in:
Evan You 2019-11-22 18:09:26 -05:00
parent 5c691aebfd
commit 24b4120c21
9 changed files with 33 additions and 27 deletions

View File

@ -50,7 +50,7 @@
"rollup-plugin-terser": "^5.1.1",
"rollup-plugin-typescript2": "^0.24.0",
"ts-jest": "^24.0.2",
"tsd": "^0.10.0",
"tsd": "^0.11.0",
"typescript": "^3.7.0",
"yorkie": "^2.0.0"
}

View File

@ -168,6 +168,8 @@ export interface TransitionHooks {
delayLeave?(performLeave: () => void): void
}
// The transition hooks are attached to the vnode as vnode.transition
// and will be called at appropriate timing in the renderer.
function resolveTransitionHooks(
{
appear,

View File

@ -2,8 +2,8 @@ import {
Transition as BaseTransition,
TransitionProps,
h,
SetupContext,
warn
warn,
FunctionalComponent
} from '@vue/runtime-core'
import { isObject } from '@vue/shared'
@ -14,19 +14,22 @@ export interface CSSTransitionProps extends TransitionProps {
name?: string
type?: typeof TRANSITION | typeof ANIMATION
duration?: number | { enter: number; leave: number }
// custom transition classes
enterFromClass?: string
enterActiveClass?: string
enterToClass?: string
leaveFromClass?: string
leaveActiveClass?: string
leaveToClass?: string
// if present, indicates this is a v-show transition by toggling the
// CSS display property instead of actually removing the element.
show?: boolean
}
export const CSSTransition = (
export const CSSTransition: FunctionalComponent = (
props: CSSTransitionProps,
{ slots }: SetupContext
) => h(BaseTransition, resolveCSSTransitionData(props), slots)
{ slots }
) => h(BaseTransition, resolveCSSTransitionProps(props), slots)
if (__DEV__) {
CSSTransition.props = {
@ -43,7 +46,7 @@ if (__DEV__) {
}
}
function resolveCSSTransitionData({
function resolveCSSTransitionProps({
name = 'v',
type,
duration,
@ -176,7 +179,10 @@ function whenTransitionEnds(
cb: () => void
) {
const { type, timeout, propCount } = getTransitionInfo(el, expectedType)
if (!type) return cb()
if (!type) {
return cb()
}
const endEvent = type + 'end'
let ended = 0
const end = () => {

View File

@ -71,8 +71,3 @@ export { CSSTransition } from './components/CSSTransition'
// re-export everything from core
// h, Component, reactivity API, nextTick, flags & types
export * from '@vue/runtime-core'
// Type augmentations
export interface ComponentPublicInstance {
$el: Element
}

View File

@ -1,6 +1,5 @@
import { describe } from './util'
import { expectError, expectType } from 'tsd'
import { createComponent, PropType, ref } from './index'
import { describe, createComponent, PropType, ref } from './index'
describe('with object props', () => {
interface ExpectedProps {

View File

@ -1,6 +1,13 @@
import { describe } from './util'
import { expectError } from 'tsd'
import { h, createComponent, ref, Fragment, Portal, Suspense } from './index'
import {
describe,
h,
createComponent,
ref,
Fragment,
Portal,
Suspense
} from './index'
describe('h inference w/ element', () => {
// key

2
test-dts/index.d.ts vendored
View File

@ -5,3 +5,5 @@
// that would suppress the errors that should be caught.
export * from '@vue/runtime-dom'
export function describe(_name: string, _fn: () => void): void

View File

@ -1,4 +0,0 @@
// aesthetic utility for making test-d.ts look more like actual tests
// and makes it easier to navigate test cases with folding
// it's a noop since test-d.ts files are not actually run.
export function describe(_name: string, _fn: () => void) {}

View File

@ -7203,13 +7203,12 @@ ts-jest@^24.0.2:
semver "^5.5"
yargs-parser "10.x"
tsd@^0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/tsd/-/tsd-0.10.0.tgz#092e5dbfdccaab89fd31e75a43a2e67411bcfff9"
integrity sha512-Gj/GoGBoskUJHZnja8V936sMAs3daHjZDQCqYQWMWEm4kNZLzYHvAAdV+apeg3mjsxMmvt8FByOM1AnYDdo+6g==
tsd@^0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.com/tsd/-/tsd-0.11.0.tgz#ede8b8e85850845b753fff7eaaf68dbd3673700b"
integrity sha512-klKMNC0KRzUIaLJG8XqkvH/9rKwYX74xpqJBN8spWjYUDojAesd6AfDCT5dray+yhLfTGkem7O3nU6i4KwzNDw==
dependencies:
eslint-formatter-pretty "^1.3.0"
execa "^2.0.4"
globby "^9.1.0"
meow "^5.0.0"
path-exists "^3.0.0"