Commit Graph

114 Commits

Author SHA1 Message Date
HcySunYang
955450f539
types(runtime-core): improve the extracted instance types (#1936) 2020-08-24 21:37:22 -04:00
Carlos Rodrigues
c2913d57d1
fix(types): handling PropType<Function> with default value (#1896)
fix #1891
2020-08-19 16:36:42 -04:00
Evan You
eb2ae44d94 refactor(types): widen Component type to include consutructor types
returned from `defineComponent`

ref: https://github.com/vuejs/vue-router-next/pull/421
also close #1880

Previous `Component` type is now exported as `ConcreteComponent`.

This introduces a minor breaking change when calling `h(comp, { ... })`
will now fail if `comp` is a of generic `Component` type, since it does
not specify what props it expects.
2020-08-19 16:19:25 -04:00
Carlos Rodrigues
4baf852a34
types(runtime-core): make FunctionalComponent with emit string[] to be Component (#1879)
fix #1847
2020-08-19 10:00:48 -04:00
Carlos Rodrigues
c86e7ad11b
types(reactivity): improve typings for shallowRef (#1780) 2020-08-18 23:34:29 -04:00
Evan You
9f92871c80 types(runtime-core): argument for props validator
Unfortunately it requires explicit annotation for now
2020-08-18 11:37:34 -04:00
Aurelius333
a88895b5da
types(runtime-core): make this void in prop validators and prop default factories (#1867) 2020-08-18 11:25:55 -04:00
HcySunYang
9d36c61796
types(runtime-core): improve PropType inference precision (#1863) 2020-08-18 11:23:18 -04:00
Herrington Darkholme
6f8bac5fca
test(types): add prop validator test (#1769)
Due to the limitation of TS, prop validator must be fully annotated
refer to https://github.com/microsoft/TypeScript/issues/38623
2020-08-14 17:40:41 -04:00
Pick
44448fdd22
types(reactivity): add dts for proxyRefs & improve typings (#1786) 2020-08-14 17:37:36 -04:00
Aurelius333
5002ab53d6
types(runtime-core): make this void in emits validator (#1842) 2020-08-14 17:36:26 -04:00
Evan You
aa06b1034d
feat(reactivity): proxyRefs method and ShallowUnwrapRefs type (#1682)
* feat(reactivity): `proxyRefs` method and `ShallowUnwrapRefs` type

BREAKING CHANGE: template auto ref unwrapping are now applied shallowly,
i.e. only at the root level. See https://github.com/vuejs/vue-next/pull/1682 for
more details.
2020-07-28 16:30:56 -04:00
Carlos Rodrigues
421a70de5e
test(types): test computed get/set type inference (#1709) 2020-07-28 15:40:23 -04:00
Carlos Rodrigues
5681fdb211
test(types): test dts for Options API method return type inference (#1708) 2020-07-28 15:31:23 -04:00
HcySunYang
5d8a64d53a
feat(types): deny unknown attributes on component by default (#1614)
close #1519
2020-07-17 11:43:28 -04:00
Guillaume Chau
568b6db12b
feat: Initial devtools support (#1125) 2020-07-16 18:18:52 -04:00
Pick
b772bba558
feat(types/reactivity): use DeepReadonly type for readonly return type (#1462)
close #1452
2020-07-15 09:27:21 -04:00
Carlos Rodrigues
d78a6821f5
types(runtime-core): default SetupContext generic argument to EmitsOptions (#1584) 2020-07-15 09:19:20 -04:00
Carlos Rodrigues
1e90605c15
types(runtime-core): provide valid type for default $emit (#1498) 2020-07-08 11:51:03 -04:00
wonderful-panda
a5b4332c69
fix(types/tsx): add JSX.IntrinsicAttributes definition (#1517)
fix #1516
2020-07-06 21:59:26 -04:00
Evan You
82b28a5ecb fix(types): should unwrap array -> object -> ref 2020-06-29 12:26:28 -04:00
Evan You
2961e149c9 fix(types): ensure correct public props interface for defineComponent instance type
fix #1385
2020-06-16 12:00:18 -04:00
Cédric Exbrayat
cab769f174
fix(types): add RawSlots in h signature (#1293) 2020-06-12 10:38:56 -04:00
doly mood
d3c436ae2e
feat(types): mixins/extends support in TypeScript (#626) 2020-06-09 10:37:00 -04:00
Carlos Rodrigues
97dedebd80
feat(types): update to Typescript 3.9 (#1106) 2020-06-09 10:17:42 -04:00
Evan You
bc1f097e29 fix(types/reactivity): fix ref type inference on nested reactive properties with .value
fix #1111
2020-05-04 08:51:17 -04:00
Carlos Rodrigues
f3a9b516bd
fix(types): make return type of defineComponent assignable to Component type (#1032)
fix #993
2020-04-24 13:22:58 -04:00
Carlos Rodrigues
0bdd889156
fix(types): fix ref(false) type to Ref<boolean> (#1028) 2020-04-22 11:54:54 -04:00
Evan You
c0adb67c2e feat(types): expose ComponentCustomOptions for declaring custom options 2020-04-17 09:41:36 -04:00
Evan You
be21cfb1db feat(types): feat(types): add ComponentCustomProperties interface (#982) 2020-04-17 09:12:50 -04:00
Carlos Rodrigues
d7ae1d0244
test(reactivity): add tests for object with symbols (#969) 2020-04-16 09:24:46 -04:00
Carlos Rodrigues
acfcc55aac
types(ref): fix dts test for ref (#965) 2020-04-15 12:15:13 -04:00
pikax
8a74260b70 types: remove tuple check and add type check for tuple 2020-04-15 16:22:44 +01:00
pikax
6a66b7b60a Merge remote-tracking branch 'github/master' into changing_unwrap_ref 2020-04-13 18:32:14 +01:00
Thorsten Lünborg
33ccfc0a8b
fix(types): UnwrapRef should bail on DOM element types (#952)
fix #951
2020-04-13 11:51:32 -04:00
pikax
c20d8af8c0 types: add symbolExtract to extract all known symbols
#951
2020-04-12 11:45:56 +01:00
Evan You
c1d5928f3b fix(types): accept generic Component type in h()
fix #922
2020-04-04 13:29:29 -04:00
Evan You
24e9efcc21 refactor(runtime-core): extract component emit related logic into dedicated file 2020-04-03 19:08:17 -04:00
Evan You
bf473a64ea feat(runtime-core): type and attr fallthrough support for emits option 2020-04-03 12:05:52 -04:00
Evan You
c409d4f297 test(types): fix dts test 2020-04-03 10:51:17 -04:00
Evan You
0cf3f78134 test(types): also test Object as PropType casting 2020-04-03 09:29:21 -04:00
Carlos Rodrigues
026eb729f3
fix(types): allow use PropType with Function (#915)
close #748
2020-04-03 09:28:13 -04:00
Evan You
10c0ba507a test: fix dts tests for Teleport renaming 2020-04-01 22:04:55 -04:00
Evan You
e67f655b26 refactor(runtime-core): revert setup() result reactive conversion
BREAKING CHANGE: revert setup() result reactive conversion

    Revert 6b10f0c & a840e7d. The motivation of the original change was
    avoiding unnecessary deep conversions, but that can be achieved by
    explicitly marking values non-reactive via `markNonReactive`.

    Removing the reactive conversion behavior leads to an usability
    issue in that plain objects containing refs (which is what most
    composition functions will return), when exposed as a nested
    property from `setup()`, will not unwrap the refs in templates. This
    goes against the "no .value in template" intuition and the only
    workaround requires users to manually wrap it again with `reactive()`.

    So in this commit we are reverting to the previous behavior where
    objects returned from `setup()` are implicitly wrapped with
    `reactive()` for deep ref unwrapping.
2020-02-26 19:01:42 -05:00
Evan You
9aaeeede62 test: add type test for nested refs in ref.value 2020-02-25 20:38:09 -05:00
Evan You
d4c6957e2d fix(types): ref value type unwrapping should happen at creation time 2020-02-25 19:44:06 -05:00
Evan You
e9024bf1b7 feat(reactivity): expose unref and shallowRef 2020-02-22 04:39:32 +01:00
Evan You
627b9df4a2 fix(types): improve ref typing, close #759 2020-02-21 17:45:42 +01:00
Evan You
a840e7ddf0 fix(types): update setup binding unwrap types for 6b10f0c
close #738
2020-02-19 18:29:18 +01:00
Evan You
cb03362b08 chore: fix dts tests 2020-02-17 23:26:25 -05:00
Evan You
9571ede84b refactor(watch): adjsut watch API behavior
BREAKING CHANGE: `watch` behavior has been adjusted.

    - When using the `watch(source, callback, options?)` signature, the
      callback now fires lazily by default (consistent with 2.x
      behavior).

      Note that the `watch(effect, options?)` signature is still eager,
      since it must invoke the `effect` immediately to collect
      dependencies.

    - The `lazy` option has been replaced by the opposite `immediate`
      option, which defaults to `false`. (It's ignored when using the
      effect signature)

    - Due to the above changes, the `watch` option in Options API now
      behaves exactly the same as 2.x.

    - When using the effect signature or `{ immediate: true }`, the
      intital execution is now performed synchronously instead of
      deferred until the component is mounted. This is necessary for
      certain use cases to work properly with `async setup()` and
      Suspense.

      The side effect of this is the immediate watcher invocation will
      no longer have access to the mounted DOM. However, the watcher can
      be initiated inside `onMounted` to retain previous behavior.
2020-02-17 23:16:58 -05:00
Evan You
77103e1fd7 types: fix tsx dts tests 2020-02-15 21:48:45 -05:00
Evan You
c6a9787941 fix(types): ensure correct oldValue typing based on lazy option
close #719
2020-02-13 12:09:13 -05:00
Evan You
8c892e0392 test: fix dts tests for 1ccecc0 2020-01-27 16:00:17 -05:00
IU
2b4d0d6501 types(reactivity): handle primitive + object intersection types in UnwrapRef (#614) 2020-01-16 17:47:47 -05:00
Cédric Exbrayat
2f6ec45d10 test: reformat defineComponent dts test (#631) 2020-01-16 17:46:25 -05:00
Cédric Exbrayat
74baea108a fix(types): components options should accept components defined with defineComponent (#602) 2020-01-13 17:12:45 -05:00
Evan You
7df5e70c83 types: accept defineComponent return types in app.mount 2019-12-24 11:04:44 -05:00
Chris Fritz
1c4cdd841d refactor(createComponent): rename to defineComponent (#549) 2019-12-22 10:58:12 -05:00
Evan You
24b4120c21 types: fix dts 2019-11-22 18:09:26 -05:00
Evan You
08bf9976ae types: ensure props are readonly 2019-11-09 18:40:25 -05:00
Evan You
a5f962ab8e test(types): assert props are readonly 2019-11-09 10:03:58 -05:00
Evan You
dfc7c0f12a refactor: adjust internal vnode types + more dts tests 2019-11-04 18:38:55 -05:00
Evan You
66ecd8b47f types: setup tests for built d.ts files 2019-11-01 22:54:01 -04:00