vue 2.7.1 → 2.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -133,7 +133,9 @@ declare type MultiWatchSources = (WatchSource<unknown> | object)[];
133
133
 
134
134
  export declare function nextTick(): Promise<void>;
135
135
 
136
- export declare function nextTick(cb: (...args: any[]) => any, ctx?: object): void;
136
+ export declare function nextTick<T>(this: T, cb: (this: T, ...args: any[]) => any): void;
137
+
138
+ export declare function nextTick<T>(cb: (this: T, ...args: any[]) => any, ctx: T): void;
137
139
 
138
140
  export declare const onActivated: (fn: () => void, target?: any) => void;
139
141
 
@@ -29,12 +29,6 @@ export type EmitFn<
29
29
  }[Event]
30
30
  >
31
31
 
32
- export type ComponentRenderEmitFn<
33
- Options = ObjectEmitsOptions,
34
- Event extends keyof Options = keyof Options,
35
- T extends Vue | void = void
36
- > = EmitFn<Options, Event, T>
37
-
38
32
  export interface SetupContext<E extends EmitsOptions = {}> {
39
33
  attrs: Data
40
34
  slots: Slots
package/types/vnode.d.ts CHANGED
@@ -1,4 +1,18 @@
1
1
  import { Vue } from './vue'
2
+ import { DirectiveFunction, DirectiveOptions } from './options'
3
+
4
+ /**
5
+ * For extending allowed non-declared props on components in TSX
6
+ */
7
+ export interface ComponentCustomProps {}
8
+
9
+ /**
10
+ * Default allowed non-declared props on component in TSX
11
+ */
12
+ export interface AllowedComponentProps {
13
+ class?: unknown
14
+ style?: unknown
15
+ }
2
16
 
3
17
  export type ScopedSlot = (props: any) => ScopedSlotReturnValue
4
18
  type ScopedSlotReturnValue =
@@ -86,4 +100,5 @@ export interface VNodeDirective {
86
100
  arg?: string
87
101
  oldArg?: string
88
102
  modifiers?: { [key: string]: boolean }
103
+ def?: DirectiveFunction | DirectiveOptions
89
104
  }
@@ -1,189 +0,0 @@
1
- import { ExtractDefaultPropTypes, ExtractPropTypes } from './v3-component-props'
2
- import {
3
- nextTick,
4
- ShallowUnwrapRef,
5
- UnwrapNestedRefs,
6
- WatchOptions,
7
- WatchStopHandle
8
- } from './v3-generated'
9
- import { Data } from './common'
10
-
11
- import { Vue, VueConstructor } from './vue'
12
- import { ComponentOptions as Vue2ComponentOptions } from './options'
13
- import {
14
- ComputedOptions,
15
- MethodOptions,
16
- ExtractComputedReturns
17
- } from './v3-component-options'
18
- import {
19
- ComponentRenderEmitFn,
20
- EmitFn,
21
- EmitsOptions,
22
- ObjectEmitsOptions,
23
- Slots
24
- } from './v3-setup-context'
25
-
26
- type EmitsToProps<T extends EmitsOptions> = T extends string[]
27
- ? {
28
- [K in string & `on${Capitalize<T[number]>}`]?: (...args: any[]) => any
29
- }
30
- : T extends ObjectEmitsOptions
31
- ? {
32
- [K in string &
33
- `on${Capitalize<string & keyof T>}`]?: K extends `on${infer C}`
34
- ? T[Uncapitalize<C>] extends null
35
- ? (...args: any[]) => any
36
- : (
37
- ...args: T[Uncapitalize<C>] extends (...args: infer P) => any
38
- ? P
39
- : never
40
- ) => any
41
- : never
42
- }
43
- : {}
44
-
45
- export type ComponentInstance = InstanceType<VueConstructor>
46
-
47
- // public properties exposed on the proxy, which is used as the render context
48
- // in templates (as `this` in the render option)
49
- export type ComponentRenderProxy<
50
- P = {}, // props type extracted from props option
51
- B = {}, // raw bindings returned from setup()
52
- D = {}, // return from data()
53
- C extends ComputedOptions = {},
54
- M extends MethodOptions = {},
55
- Mixin = {},
56
- Extends = {},
57
- Emits extends EmitsOptions = {},
58
- PublicProps = P,
59
- Defaults = {},
60
- MakeDefaultsOptional extends boolean = false
61
- > = {
62
- $data: D
63
- $props: Readonly<
64
- MakeDefaultsOptional extends true
65
- ? Partial<Defaults> & Omit<P & PublicProps, keyof Defaults>
66
- : P & PublicProps
67
- >
68
- $attrs: Record<string, string>
69
- $emit: ComponentRenderEmitFn<
70
- Emits,
71
- keyof Emits,
72
- ComponentRenderProxy<
73
- P,
74
- B,
75
- D,
76
- C,
77
- M,
78
- Mixin,
79
- Extends,
80
- Emits,
81
- PublicProps,
82
- Defaults,
83
- MakeDefaultsOptional
84
- >
85
- >
86
- } & Readonly<P> &
87
- ShallowUnwrapRef<B> &
88
- D &
89
- M &
90
- ExtractComputedReturns<C> &
91
- Omit<Vue, '$data' | '$props' | '$attrs' | '$emit'>
92
-
93
- // for Vetur and TSX support
94
- type VueConstructorProxy<
95
- PropsOptions,
96
- RawBindings,
97
- Data,
98
- Computed extends ComputedOptions,
99
- Methods extends MethodOptions,
100
- Mixin = {},
101
- Extends = {},
102
- Emits extends EmitsOptions = {},
103
- Props = ExtractPropTypes<PropsOptions> &
104
- ({} extends Emits ? {} : EmitsToProps<Emits>)
105
- > = Omit<VueConstructor, never> & {
106
- new (...args: any[]): ComponentRenderProxy<
107
- Props,
108
- ShallowUnwrapRef<RawBindings>,
109
- Data,
110
- Computed,
111
- Methods,
112
- Mixin,
113
- Extends,
114
- Emits,
115
- Props,
116
- ExtractDefaultPropTypes<PropsOptions>,
117
- true
118
- >
119
- }
120
-
121
- type DefaultData<V> = object | ((this: V) => object)
122
- type DefaultMethods<V> = { [key: string]: (this: V, ...args: any[]) => any }
123
- type DefaultComputed = { [key: string]: any }
124
-
125
- export type VueProxy<
126
- PropsOptions,
127
- RawBindings,
128
- Data = DefaultData<Vue>,
129
- Computed extends ComputedOptions = DefaultComputed,
130
- Methods extends MethodOptions = DefaultMethods<Vue>,
131
- Mixin = {},
132
- Extends = {},
133
- Emits extends EmitsOptions = {}
134
- > = Vue2ComponentOptions<
135
- Vue,
136
- ShallowUnwrapRef<RawBindings> & Data,
137
- Methods,
138
- Computed,
139
- PropsOptions,
140
- ExtractPropTypes<PropsOptions>
141
- > &
142
- VueConstructorProxy<
143
- PropsOptions,
144
- RawBindings,
145
- Data,
146
- Computed,
147
- Methods,
148
- Mixin,
149
- Extends,
150
- Emits
151
- >
152
-
153
- // public properties exposed on the proxy, which is used as the render context
154
- // in templates (as `this` in the render option)
155
- export type ComponentPublicInstance<
156
- P = {}, // props type extracted from props option
157
- B = {}, // raw bindings returned from setup()
158
- D = {}, // return from data()
159
- C extends ComputedOptions = {},
160
- M extends MethodOptions = {},
161
- E extends EmitsOptions = {},
162
- PublicProps = P,
163
- Defaults = {},
164
- MakeDefaultsOptional extends boolean = false
165
- > = {
166
- $data: D
167
- $props: MakeDefaultsOptional extends true
168
- ? Partial<Defaults> & Omit<P & PublicProps, keyof Defaults>
169
- : P & PublicProps
170
- $attrs: Data
171
- $refs: Data
172
- $slots: Slots
173
- $root: ComponentPublicInstance | null
174
- $parent: ComponentPublicInstance | null
175
- $emit: EmitFn<E>
176
- $el: any
177
- // $options: Options & MergedComponentOptionsOverride
178
- $forceUpdate: () => void
179
- $nextTick: typeof nextTick
180
- $watch(
181
- source: string | Function,
182
- cb: Function,
183
- options?: WatchOptions
184
- ): WatchStopHandle
185
- } & P &
186
- ShallowUnwrapRef<B> &
187
- UnwrapNestedRefs<D> &
188
- ExtractComputedReturns<C> &
189
- M