Typescript 覆盖npm包的类型定义
我将direct vuex软件包与vuexfire一起使用。现在,为了与vuexfire兼容,我需要更改direct vuex包中的一些类型def 我该怎么做 当我在类型文件中声明direct vuex模块时,它不起作用。我的另一种类型工作得很好Typescript 覆盖npm包的类型定义,typescript,vue.js,vuex,typescript-typings,Typescript,Vue.js,Vuex,Typescript Typings,我将direct vuex软件包与vuexfire一起使用。现在,为了与vuexfire兼容,我需要更改direct vuex包中的一些类型def 我该怎么做 当我在类型文件中声明direct vuex模块时,它不起作用。我的另一种类型工作得很好 declare module 'direct-vuex' { export type ToDirectStore<O extends AppStore> = ShowContent<{ readonly state: S
declare module 'direct-vuex' {
export type ToDirectStore<O extends AppStore> = ShowContent<{
readonly state: ShowContent<DirectState<O>>
getters: ShowContent<DirectGetters<O>>
commit: ShowContent<DirectMutations<O>>
dispatch: ShowContent<DirectActions<O>>
original: VuexStore<O>
}>
type DirectActions<O extends StoreOrModuleOptions> =
ToDirectActions<OrEmpty<O['actions']>>
& GetActionsInModules<FilterNamespaced<OrEmpty<O['modules']>>>
& MergeActionsFromModules<FilterNotNamespaced<OrEmpty<O['modules']>>>
type ToDirectActions<T extends ActionsImpl> = {
[K in keyof T]: Parameters<T[K]>[1] extends undefined
? (() => PromiseOf<ReturnType<T[K]>>)
: ((payload >>>>>> Here i need to add a "?" sign <<<<<<<<<: Parameters<T[K]>[1]) => PromiseOf<ReturnType<T[K]>>)
}
}
声明模块“direct vuex”{
导出类型ToDirectStore=ShowContent
类型直接作用=
ToDirections
&GetActionsInModules
&合并来自模块的操作
类型ToDirections={
[K in keyof T]:参数[1]扩展未定义
(()=>承诺人)
:((有效载荷>>>>>>这里我需要添加一个“?”符号