Skip to content

Commit 51d70a0

Browse files
authored
Merge pull request #2079 from didi/fix-options-computed-type
fix(type): 修复选项式组件计算属性无法跳转定义位置
2 parents 0d97144 + 3f5dbfe commit 51d70a0

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

packages/store/@types/index.d.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,21 +139,14 @@ export interface Store<S = {}, G = {}, M = {}, A = {}, D extends Deps = {}> {
139139
mapActionsToInstance<K extends keyof A>(maps: K[], context: compContext): Pick<GetActions<A>, K>
140140
mapActionsToInstance(depPath: string, maps: string[], context: compContext): void
141141
}
142-
type GetComputedSetKeys<T> = {
143-
[K in keyof T]: T[K] extends {
144-
get(): any,
145-
set(val: any): void
146-
} ? K : never
147-
}[keyof T]
148142

149143
export type GetComputedType<T> = {
150-
readonly [K in Exclude<keyof T, GetComputedSetKeys<T>>]: T[K] extends () => infer R ? R : T[K]
151-
} & {
152-
[K in GetComputedSetKeys<T>]: T[K] extends {
153-
get(): infer R,
154-
set(val: any): void
155-
} ? R : T[K]
156-
}
144+
[K in keyof T]: T[K] extends { get: (...args: any[]) => infer R }
145+
? R
146+
: T[K] extends (...args: any[]) => infer R
147+
? R
148+
: never
149+
}
157150

158151
interface MutationsAndActionsWithThis {
159152
[key: string]: (...payload: any[]) => any

0 commit comments

Comments
 (0)