8000 refactor: rename Context to SetupContext · Kingwl/vue-function-api@cb201ed · GitHub
[go: up one dir, main page]

Skip to content

Commit cb201ed

Browse files
committed
refactor: rename Context to SetupContext
1 parent 6ee3298 commit cb201ed

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Vue, { VueConstructor } from 'vue';
2-
import { Context } from './types/vue';
2+
import { SetupContext } from './types/vue';
33
import { currentVue } from './runtimeContext';
44
import { Wrapper } from './wrappers';
55
import { install } from './install';
@@ -10,7 +10,7 @@ declare module 'vue/types/options' {
1010
setup?: (
1111
this: undefined,
1212
props: { [x: string]: any },
13-
context: Context
13+
context: SetupContext
1414
) => object | null | undefined | void;
1515
}
1616
}

src/setup.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { VueConstructor } from 'vue';
2-
import { Context } from './types/vue';
2+
import { SetupContext } from './types/vue';
33
import { isWrapper } from './helper';
44
import { setCurrentVM } from './runtimeContext';
55
import { isPlainObject, assert, proxy, isFunction } from './utils';
@@ -73,8 +73,8 @@ export function mixin(Vue: VueConstructor) {
7373
});
7474
}
7575

76-
function createContext(vm: any): Context {
77-
const ctx = {} as Context;
76+
function createContext(vm: any): SetupContext {
77+
const ctx = {} as SetupContext;
7878
const props = [
7979
// 'el', // has workaround
8080
// 'options',

src/ts-api/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// import Vue from 'vue';
22
import Vue, { ComponentOptions } from 'vue';
3-
import { Context } from '../types/vue';
3+
import { SetupContext } from '../types/vue';
44

55
export type PropType<T> = T;
66

@@ -11,7 +11,7 @@ type ComponentOptionsWithSetup<Props> = Omit<ComponentOptions<Vue>, 'props' | 's
1111
setup?: (
1212
this: undefined,
1313
props: { [K in keyof Props]: Props[K] },
14-
context: Context
14+
context: SetupContext
1515
) => object | null | undefined | void;
1616
};
1717

src/types/vue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Vue, { VNode } from 'vue/';
22

3-
export interface Context {
3+
export interface SetupContext {
44
readonly parent: Vue;
55
readonly root: Vue;
66
readonly refs: { [key: string]: Vue | Element | Vue[] | Element[] };

0 commit comments

Comments
 (0)
0