]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
types: fix dts
authorEvan You <yyx990803@gmail.com>
Fri, 22 Nov 2019 23:09:26 +0000 (18:09 -0500)
committerEvan You <yyx990803@gmail.com>
Fri, 22 Nov 2019 23:09:26 +0000 (18:09 -0500)
package.json
packages/runtime-core/src/components/Transition.ts
packages/runtime-dom/src/components/CSSTransition.ts
packages/runtime-dom/src/index.ts
test-dts/createComponent.test-d.tsx
test-dts/h.test-d.ts
test-dts/index.d.ts
test-dts/util.ts [deleted file]
yarn.lock

index b288edf82709ef83becf59a362b42427e342c68e..045f1c1742caba4ea70fd589750d628a13c53ea6 100644 (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"
   }
index 34d9e5f199d3049c446c72f42730c307bf78d295..1d4d3febfca37a83fde853e3b26650f20c97f4f6 100644 (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,
index 09862ec4b7be6687e6589468529a572edcb06792..c3a858f826321f767963bb5c17efd384896e7212 100644 (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 = () => {
index f093ac505972da2b4cc24661af20e925671a6146..ea736067f6140e6569bce0d13e249b3d1db2a553 100644 (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
-}
index ce15c70428c92391a2a7d313ff2e1aabc73cd050..aba58c7187f74914f31ccbae66913cb921f19c7d 100644 (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 {
index a017dafc64ea74e834224f572d1a1798da923c67..7998a6c55702f24bb80ad21ca17ef34379028f22 100644 (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
index f61c077a50bb0205447f925fbb0f8eb18df9b130..757dfb407912f91776405a0eec85424be9f2bd13 100644 (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
diff --git a/test-dts/util.ts b/test-dts/util.ts
deleted file mode 100644 (file)
index 7745382..0000000
+++ /dev/null
@@ -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) {}
index 85677f78dbd7d413cf4d79dad210bac81418e8a4..4200607140c78c21397cf386b2ab5afb187ad480 100644 (file)
--- a/yarn.lock
+++ b/yarn.lock
@@ -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"