types(defineComponent): DefineComponent refactor#4465
types(defineComponent): DefineComponent refactor#4465pikax wants to merge 53 commits intovuejs:mainfrom
Conversation
# Conflicts: # packages/runtime-core/src/component.ts # packages/runtime-core/src/componentEmits.ts # packages/runtime-core/src/componentOptions.ts # test-dts/h.test-d.ts # yarn.lock
# Conflicts: # packages/runtime-core/src/componentOptions.ts
# Conflicts: # packages/runtime-core/src/component.ts # packages/runtime-core/src/componentOptions.ts # packages/runtime-core/src/componentProps.ts
# Conflicts: # packages/runtime-core/src/componentOptions.ts # packages/runtime-core/src/componentPublicInstance.ts # packages/runtime-dom/src/directives/vModel.ts # packages/runtime-dom/src/directives/vOn.ts # packages/runtime-dom/src/index.ts
# Conflicts: # packages/runtime-core/src/componentOptions.ts
…fineComponent_and_Component # Conflicts: # packages/runtime-core/src/apiDefineComponent.ts # packages/runtime-core/src/component.ts # packages/runtime-core/src/componentEmits.ts # packages/runtime-core/src/componentOptions.ts # packages/runtime-core/src/h.ts
…s/Merge_DefineComponent_and_Component # Conflicts: # packages/runtime-core/src/apiDefineComponent.ts
…_DefineComponent_and_Component # Conflicts: # packages/runtime-core/src/apiDefineComponent.ts # packages/runtime-core/src/componentOptions.ts # packages/runtime-core/src/componentPublicInstance.ts # test-dts/defineComponent.test-d.tsx
| * | ||
| * declare module '@vue/runtime-core' { | ||
| * interface GlobalDirectives { | ||
| * VTooltip |
There was a problem hiding this comment.
We should suggest using camelCase or kebab-case version of directive (without the v prefix); similar to local registration in component options.
| components?: Record<string, Component> | ||
| directives?: Record<string, Directive> | ||
| components?: LC | ||
| directives?: Directives |
There was a problem hiding this comment.
Should it be called LD to align with components option?
| Slots = {}, | ||
| // Allows to expose public API properties, this bypasses Data/Computed/Methods, | ||
| // easier to declare manually | ||
| Bindings extends Record<string, unknown> = {}, |
There was a problem hiding this comment.
Public API of a component is props, emits, slots and expose. What do you think about Expose being 4th param?
| }[Event] | ||
| > | ||
| >) & | ||
| EmitVModelUpdate<P> |
There was a problem hiding this comment.
Is this adding emit('update:foo') for every prop even if they don't have an emit declared for it?
| import { toRaw } from '@vue/reactivity' | ||
|
|
||
| export type Slot = (...args: any[]) => VNode[] | ||
| export type Slot = (...args: any[]) => VNode[] | VNode |
There was a problem hiding this comment.
h(Foo, () => {...} can return a single VNode but slots.default() is normalised so should always be VNode[]
| resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.2.tgz#6d618640d430e3569a1dfb44f7d7e600ced3ee86" | ||
| integrity sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ== | ||
|
|
||
| typescript@~4.3.5: |
There was a problem hiding this comment.
|
Closed in favor of #9556 |
This PR aims to refactor
DefineComponentto merge it withComponenttypeBecause this will break the prev DefineComponent I've merged a few PR into this one
Merged PR
#2164
#2693
#3399
#2494