mirror of
https://github.com/vuejs/vue.git
synced 2024-11-21 20:28:54 +00:00
fix(types): vue 3 directive type compatibility (#12792)
This commit is contained in:
parent
2f335b2f9d
commit
27eed829cc
7
types/options.d.ts
vendored
7
types/options.d.ts
vendored
@ -4,6 +4,7 @@ import { SetupContext } from './v3-setup-context'
|
|||||||
import { DebuggerEvent } from './v3-generated'
|
import { DebuggerEvent } from './v3-generated'
|
||||||
import { DefineComponent } from './v3-define-component'
|
import { DefineComponent } from './v3-define-component'
|
||||||
import { ComponentOptionsMixin } from './v3-component-options'
|
import { ComponentOptionsMixin } from './v3-component-options'
|
||||||
|
import { ObjectDirective, FunctionDirective } from './v3-directive'
|
||||||
|
|
||||||
type Constructor = {
|
type Constructor = {
|
||||||
new (...args: any[]): any
|
new (...args: any[]): any
|
||||||
@ -318,6 +319,9 @@ export interface DirectiveBinding extends Readonly<VNodeDirective> {
|
|||||||
readonly modifiers: { [key: string]: boolean }
|
readonly modifiers: { [key: string]: boolean }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use {@link FunctionDirective} instead
|
||||||
|
*/
|
||||||
export type DirectiveFunction = (
|
export type DirectiveFunction = (
|
||||||
el: HTMLElement,
|
el: HTMLElement,
|
||||||
binding: DirectiveBinding,
|
binding: DirectiveBinding,
|
||||||
@ -325,6 +329,9 @@ export type DirectiveFunction = (
|
|||||||
oldVnode: VNode
|
oldVnode: VNode
|
||||||
) => void
|
) => void
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use {@link ObjectDirective} instead
|
||||||
|
*/
|
||||||
export interface DirectiveOptions {
|
export interface DirectiveOptions {
|
||||||
bind?: DirectiveFunction
|
bind?: DirectiveFunction
|
||||||
inserted?: DirectiveFunction
|
inserted?: DirectiveFunction
|
||||||
|
5
types/vue.d.ts
vendored
5
types/vue.d.ts
vendored
@ -22,6 +22,7 @@ import {
|
|||||||
ExtractComputedReturns,
|
ExtractComputedReturns,
|
||||||
ComponentOptionsMixin
|
ComponentOptionsMixin
|
||||||
} from './v3-component-options'
|
} from './v3-component-options'
|
||||||
|
import { Directive, ObjectDirective } from './v3-directive'
|
||||||
|
|
||||||
export interface CreateElement {
|
export interface CreateElement {
|
||||||
(
|
(
|
||||||
@ -338,6 +339,10 @@ export interface VueConstructor<V extends Vue = Vue> {
|
|||||||
id: string,
|
id: string,
|
||||||
definition?: DirectiveOptions | DirectiveFunction
|
definition?: DirectiveOptions | DirectiveFunction
|
||||||
): DirectiveOptions
|
): DirectiveOptions
|
||||||
|
directive(
|
||||||
|
id: string,
|
||||||
|
definition?: Directive
|
||||||
|
): ObjectDirective
|
||||||
filter(id: string, definition?: Function): Function
|
filter(id: string, definition?: Function): Function
|
||||||
|
|
||||||
component(id: string): VueConstructor
|
component(id: string): VueConstructor
|
||||||
|
Loading…
Reference in New Issue
Block a user