types(defineComponent): Support for GlobalComponents, typed Directives and respect expose on defineComponent#3399
Conversation
|
Thanks for this update, custom directives IntelliSense and Type-Checking is coming! We also need |
@johnsoncodehk Edit: After reviewing the code, I think it can be implemented in this PR if possible |
Maybe a better name would be good, any suggestions? |
|
|
Look good, but inconsistent... declare module 'vue' {
interface ComponentCustomOptions { }
interface ComponentCustomProperties { }
interface GlobalComponents { }
interface GlobalDirectives { }
} |
It looks inconsistent but they mean different things
As you can see they usually mean different things, altho the Components/Directives are used on the components, they are not enhancing the component interaction, but to provide enhancement to the render. I mean this is my logic on the naming, might be incorrect 😄 Having |
|
yeah, they are different. |
# Conflicts: # packages/dts-test/defineComponent.test-d.tsx # packages/runtime-core/src/apiDefineComponent.ts # packages/runtime-core/src/componentPublicInstance.ts
|
/ecosystem-ci run |
This comment was marked as outdated.
This comment was marked as outdated.
# Conflicts: # packages/dts-test/appUse.test-d.ts # packages/dts-test/defineComponent.test-d.tsx # packages/runtime-core/src/apiCreateApp.ts # packages/runtime-core/src/apiDefineComponent.ts # packages/runtime-core/src/componentOptions.ts # packages/runtime-core/src/componentPublicInstance.ts # packages/runtime-core/src/directives.ts # packages/runtime-core/src/index.ts # packages/runtime-dom/src/directives/vModel.ts # packages/runtime-dom/src/directives/vOn.ts # packages/runtime-dom/src/index.ts
|
Can this be merged? |
|
Note, one thing I figured out you can do is simply use TypeScript's <div
v-popover="{
html: true,
title: vm.tooltipTitle(),
placement: 'right',
trigger: 'click',
content: vm.tooltipContent()
} satisfies PopoverOptions"
></div>Volar's code syntax coloring of It would be great if there was an ESLint plugin then to force / enforce the use of |
expose on defineComponent
|
/ecosystem-ci run |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
📝 Ran ecosystem CI: Open
|
unplugin-vue-components now generates this file. See: - vuejs/core#3399
fix #3367
Changes
Components- to allow extraction of the components availableDirectivesandComponentCustomDirectives(aka global directives)exposed- this is a bit different from the actual implementation, this types will allow the exposed vue internal component typesDirectivetype, allowing to specify the modifiers and the expected argument.Directive usage
Now
Directiveswill hold more types to help the extensions: