-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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/componentTypeExtensions.test-d.tsx # packages/dts-test/defineComponent.test-d.tsx # packages/dts-test/directives.test-d.ts # packages/runtime-core/__tests__/componentPublicInstance.spec.ts # packages/runtime-core/__tests__/rendererTemplateRef.spec.ts # packages/runtime-core/src/apiDefineComponent.ts # packages/runtime-core/src/componentOptions.ts # packages/runtime-core/src/componentPublicInstance.ts # packages/runtime-core/src/hydration.ts # packages/runtime-core/src/index.ts # packages/runtime-dom/src/directives/vModel.ts # packages/runtime-dom/src/globalComponents.d.ts # packages/runtime-dom/src/globalDirectives.d.ts # packages/shared/src/typeUtils.ts
Size ReportBundles
Usages
|
# 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
|
fix #3367
Changes
Components
- to allow extraction of the components availableDirectives
andComponentCustomDirectives
(aka global directives)exposed
- this is a bit different from the actual implementation, this types will allow the exposed vue internal component typesDirective
type, allowing to specify the modifiers and the expected argument.Directive usage
Now
Directives
will hold more types to help the extensions: