반응형
npm 패키지의 덮어쓰기 유형 정의
나는 vuexfire와 함께 direct-vuex 패키지를 사용한다.이제 나는 vuexfire와의 호환성을 위해 직접 vuex 패키지에서 몇 가지 타입 디프를 변경해야 해.
내가 어떻게 그럴 수 있을까?
내 타입 파일에 직접 vuex 모듈을 선언해도 아무런 효과가 없다.나의 다른 타입은 작동이 잘 안 된다.
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]>>)
}
}
도와줘서 고마워
참조URL: https://stackoverflow.com/questions/60016124/overwrite-type-definition-of-npm-package
반응형
'programing' 카테고리의 다른 글
가상 환경 제거/삭제 방법 (0) | 2022.04.04 |
---|---|
setState가 정의되지 않음 (0) | 2022.04.04 |
Vue 프로젝트의 보기와 구성 요소 폴더 간의 차이점은? (0) | 2022.04.03 |
페이지 새로 고침 시 NextJS에서 Redex 상태를 올바르게 수산화하는 방법 (0) | 2022.04.03 |
iOS 및 Android용 Resact Native 응용 프로그램에서 인터넷 연결을 확인하는 방법 (0) | 2022.04.03 |