Skip to content

Commit 540a38f

Browse files
Made it so that any 'data' function can only access 'props' and base Vue instance members.
1 parent 8cd5b9c commit 540a38f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: types/options.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export type Accessors<T> = {
4040
*/
4141
export type ThisTypedComponentOptions<Data, Methods, Computed, PropNames extends string = never, Instance extends AnyVue = Vue<Data, Methods, Computed, Record<PropNames, any>>> =
4242
object &
43-
ComponentOptions<Data, Methods, Computed, PropNames[] | Record<PropNames, PropOptions>> &
43+
ComponentOptions<Data | ((this: Record<PropNames, any> & AnyVue) => Data), Methods, Computed, PropNames[] | Record<PropNames, PropOptions>> &
4444
ThisType<Data & Methods & Computed & Record<PropNames, any> & Instance>;
4545

4646
/**
@@ -49,7 +49,7 @@ export type ThisTypedComponentOptions<Data, Methods, Computed, PropNames extends
4949
*/
5050
export type ThisTypedComponentOptionsWithArrayProps<Data, Methods, Computed, PropNames extends string, Instance extends AnyVue = Vue<Data, Methods, Computed, PropNames>> =
5151
object &
52-
ComponentOptions<Data, Methods, Computed, PropNames[]> &
52+
ComponentOptions<Data | ((this: Record<PropNames, any> & AnyVue) => Data), Methods, Computed, PropNames[]> &
5353
ThisType<Data & Methods & Computed & Record<PropNames, any> & Instance>;
5454

5555
/**
@@ -58,7 +58,7 @@ export type ThisTypedComponentOptionsWithArrayProps<Data, Methods, Computed, Pro
5858
*/
5959
export type ThisTypedComponentOptionsWithRecordProps<Data, Methods, Computed, Props, Instance extends AnyVue = Vue<Data, Methods, Computed, Props>> =
6060
object &
61-
ComponentOptions<Data, Methods, Computed, Props> &
61+
ComponentOptions<Data | ((this: Record<keyof Props, any> & AnyVue) => Data), Methods, Computed, Props> &
6262
ThisType<Data & Methods & Computed & Record<keyof Props, any> & Instance>;
6363

6464
/**
@@ -71,7 +71,7 @@ export type FunctionalOrStandardComponentOptions<Data, Methods, Computed, PropNa
7171

7272

7373
export interface ComponentOptions<Data, Methods, Computed, Props> {
74-
data?: Data | (() => Data);
74+
data?: Data;
7575
props?: Props;
7676
propsData?: Object;
7777
computed?: Accessors<Computed>;

0 commit comments

Comments
 (0)