Skip to content

Commit 72bde94

Browse files
committed
types: fix ComputedRefImpl type build
1 parent 5d30366 commit 72bde94

File tree

1 file changed

+35
-6
lines changed

1 file changed

+35
-6
lines changed

packages/reactivity/src/computed.ts

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
type DebuggerOptions,
55
EffectFlags,
66
type Link,
7-
type ReactiveEffect,
87
type Subscriber,
98
activeSub,
109
refreshComputed,
@@ -25,7 +24,7 @@ export interface WritableComputedRef<T> extends Ref<T> {
2524
/**
2625
* @deprecated computed no longer uses effect
2726
*/
28-
effect: ReactiveEffect
27+
effect: ComputedRefImpl
2928
}
3029

3130
export type ComputedGetter<T> = (oldValue?: T) => T
@@ -41,18 +40,43 @@ export interface WritableComputedOptions<T> {
4140
* the main vue package
4241
*/
4342
export class ComputedRefImpl<T = any> implements Subscriber {
44-
// A computed is a ref
43+
/**
44+
* @internal
45+
*/
4546
_value: any = undefined
47+
/**
48+
* @internal
49+
*/
4650
readonly dep = new Dep(this)
51+
/**
52+
* @internal
53+
*/
4754
readonly __v_isRef = true;
55+
/**
56+
* @internal
57+
*/
4858
readonly [ReactiveFlags.IS_READONLY]: boolean
4959
// A computed is also a subscriber that tracks other deps
60+
/**
61+
* @internal
62+
*/
5063
deps?: Link = undefined
64+
/**
65+
* @internal
66+
*/
5167
depsTail?: Link = undefined
52-
// track variaous states
68+
/**
69+
* @internal
70+
*/
5371
flags = EffectFlags.DIRTY
54-
// last seen global version
72+
/**
73+
* @internal
74+
*/
5575
globalVersion = globalVersion - 1
76+
/**
77+
* @internal
78+
*/
79+
isSSR: boolean
5680
// for backwards compat
5781
effect = this
5882

@@ -63,17 +87,22 @@ export class ComputedRefImpl<T = any> implements Subscriber {
6387

6488
/**
6589
* Dev only
90+
* @internal
6691
*/
6792
_warnRecursive?: boolean
6893

6994
constructor(
7095
public fn: ComputedGetter<T>,
7196
private readonly setter: ComputedSetter<T> | undefined,
72-
public isSSR: boolean,
97+
isSSR: boolean,
7398
) {
7499
this.__v_isReadonly = !setter
100+
this.isSSR = isSSR
75101
}
76102

103+
/**
104+
* @internal
105+
*/
77106
notify() {
78107
// avoid infinite self recursion
79108
if (activeSub !== this) {

0 commit comments

Comments
 (0)