Skip to content

Commit 244f6c1

Browse files
committed
wip
1 parent 6ba96d1 commit 244f6c1

File tree

2 files changed

+13
-28
lines changed

2 files changed

+13
-28
lines changed

packages/runtime-core/__tests__/apiOptions.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ describe('api: options', () => {
8484

8585
test('methods', async () => {
8686
const Comp = defineComponent({
87+
data() {
88+
// #3300 method on ctx should be overwritable
89+
this.incBy = this.incBy.bind(this, 2)
90+
return {
91+
foo: 1,
92+
}
93+
},
8794
methods: {
8895
inc() {
8996
this.foo++
@@ -92,13 +99,6 @@ describe('api: options', () => {
9299
this.foo += n
93100
},
94101
},
95-
data() {
96-
// #3300 method on ctx should be overwritable
97-
this.incBy = this.incBy.bind(this, 2)
98-
return {
99-
foo: 1,
100-
}
101-
},
102102
render() {
103103
return h(
104104
'div',

packages/runtime-core/src/apiDefineComponent.ts

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -326,22 +326,6 @@ export function defineComponent<
326326
ExtractPropTypes<CompleteProps> & TypeProps & EmitsToProps<CompleteEmits>
327327
>,
328328
// instance types
329-
DataVM = ComponentPublicInstance<
330-
InferredProps,
331-
CompleteBindings,
332-
CompleteData,
333-
CompleteComputed,
334-
CompleteMethods,
335-
CompleteEmits_Internal,
336-
{}, // PublicProps
337-
{}, // Defaults
338-
false,
339-
InjectOptions,
340-
Slots,
341-
Exposed,
342-
TypeRefs,
343-
TypeEl
344-
>,
345329
InternalInstance = ComponentPublicInstance<
346330
InferredProps,
347331
CompleteBindings,
@@ -383,7 +367,7 @@ export function defineComponent<
383367
props: NoInfer<LooseRequired<InferredProps>>,
384368
ctx: NoInfer<SetupContext<CompleteEmits_Internal, Slots>>,
385369
) => Promise<SetupBindings> | SetupBindings | RenderFunction | void
386-
data?: (this: NoInfer<DataVM>, vm: NoInfer<DataVM>) => Data
370+
data?: (vm: NoInfer<InternalInstance>) => Data
387371
/**
388372
* @private for language-tools use only
389373
*/
@@ -420,10 +404,11 @@ export function defineComponent<
420404
| 'setup'
421405
| 'data'
422406
> &
423-
ThisType<NoInfer<InternalInstance>> &
424-
ThisType<{
425-
$options: typeof options
426-
}>,
407+
ThisType<
408+
NoInfer<InternalInstance> & {
409+
$options: typeof options
410+
}
411+
>,
427412
): DefineComponent<{
428413
props?: PropsOptions
429414
emits?: string[] extends RuntimeEmitsOptions ? {} : RuntimeEmitsOptions

0 commit comments

Comments
 (0)