@@ -11,14 +11,14 @@ import { ExtractPropTypes, ComponentPropsOptions } from './componentProps'
11
11
import { isFunction } from '@vue/shared'
12
12
import { VNodeProps } from './vnode'
13
13
14
- // createComponent is a utility that is primarily used for type inference
14
+ // defineComponent is a utility that is primarily used for type inference
15
15
// when declaring components. Type inference is provided in the component
16
16
// options (provided as the argument). The returned value has artifical types
17
17
// for TSX / manual render function / IDE support.
18
18
19
19
// overload 1: direct setup function
20
20
// (uses user defined props interface)
21
- export function createComponent < Props , RawBindings = object > (
21
+ export function defineComponent < Props , RawBindings = object > (
22
22
setup : (
23
23
props : Readonly < Props > ,
24
24
ctx : SetupContext
@@ -38,7 +38,7 @@ export function createComponent<Props, RawBindings = object>(
38
38
// overload 2: object format with no props
39
39
// (uses user defined props interface)
40
40
// return type is for Vetur and TSX support
41
- export function createComponent <
41
+ export function defineComponent <
42
42
Props ,
43
43
RawBindings ,
44
44
D ,
@@ -60,7 +60,7 @@ export function createComponent<
60
60
// overload 3: object format with array props declaration
61
61
// props inferred as { [key in PropNames]?: any }
62
62
// return type is for Vetur and TSX support
63
- export function createComponent <
63
+ export function defineComponent <
64
64
PropNames extends string ,
65
65
RawBindings ,
66
66
D ,
@@ -75,7 +75,7 @@ export function createComponent<
75
75
76
76
// overload 4: object format with object props declaration
77
77
// see `ExtractPropTypes` in ./componentProps.ts
78
- export function createComponent <
78
+ export function defineComponent <
79
79
// the Readonly constraint allows TS to treat the type of { required: true }
80
80
// as constant instead of boolean.
81
81
PropsOptions extends Readonly < ComponentPropsOptions > ,
@@ -97,6 +97,6 @@ export function createComponent<
97
97
}
98
98
99
99
// implementation, close to no-op
100
- export function createComponent ( options : unknown ) {
100
+ export function defineComponent ( options : unknown ) {
101
101
return isFunction ( options ) ? { setup : options } : options
102
102
}
0 commit comments