fix(types): remove explicit return type annotation requirement for this
inference in computed options (#4221)
This commit is contained in:
parent
2f1f616650
commit
d3d5ad204d
@ -12,7 +12,7 @@ export interface WritableComputedRef<T> extends Ref<T> {
|
|||||||
readonly effect: ReactiveEffect<T>
|
readonly effect: ReactiveEffect<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ComputedGetter<T> = (ctx?: any) => T
|
export type ComputedGetter<T> = (...args: any[]) => T
|
||||||
export type ComputedSetter<T> = (v: T) => void
|
export type ComputedSetter<T> = (v: T) => void
|
||||||
|
|
||||||
export interface WritableComputedOptions<T> {
|
export interface WritableComputedOptions<T> {
|
||||||
|
@ -396,12 +396,12 @@ describe('type inference w/ options API', () => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
d(): number {
|
d() {
|
||||||
expectType<number>(this.b)
|
expectType<number>(this.b)
|
||||||
return this.b + 1
|
return this.b + 1
|
||||||
},
|
},
|
||||||
e: {
|
e: {
|
||||||
get(): number {
|
get() {
|
||||||
expectType<number>(this.b)
|
expectType<number>(this.b)
|
||||||
expectType<number>(this.d)
|
expectType<number>(this.d)
|
||||||
|
|
||||||
@ -514,10 +514,10 @@ describe('with mixins', () => {
|
|||||||
expectType<string>(props.aP1)
|
expectType<string>(props.aP1)
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
dC1(): number {
|
dC1() {
|
||||||
return this.d + this.a
|
return this.d + this.a
|
||||||
},
|
},
|
||||||
dC2(): string {
|
dC2() {
|
||||||
return this.aP1 + 'dC2'
|
return this.aP1 + 'dC2'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -926,7 +926,7 @@ describe('emits', () => {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// #3599
|
// #3599
|
||||||
this.$nextTick(function() {
|
this.$nextTick(function () {
|
||||||
// this should be bound to this instance
|
// this should be bound to this instance
|
||||||
|
|
||||||
this.$emit('click', 1)
|
this.$emit('click', 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user