Skip to content

Commit

Permalink
For danielroe#266: fix how Webstorm resolves non-dynamic stores
Browse files Browse the repository at this point in the history
  • Loading branch information
daniluk4000 committed Oct 5, 2022
1 parent 867e175 commit e03904d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/typed-vuex/src/types/modules.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { NuxtStore, MergedStoreType, BlankStore } from './store'

export type NuxtModules = Record<string, Partial<NuxtStore & {dynamic: boolean}>>
export type NuxtModules = Record<string, Partial<NuxtStore>>

type TransformedModule<T extends NuxtModules, P extends keyof T, O = string> = MergedStoreType<T[P] & BlankStore, O>

export type ModuleTransformer<T, O = string> = T extends NuxtModules
? { [P in keyof T]: T[P]['dynamic'] extends boolean ? undefined | TransformedModule<T, P, O> : TransformedModule<T, P, O> }
? { [P in keyof T]: 'dynamic' extends keyof T[P] ? undefined | TransformedModule<T, P, O> : TransformedModule<T, P, O> }
: {}
6 changes: 1 addition & 5 deletions packages/typed-vuex/src/types/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,12 @@ export interface NuxtStore {
strict: boolean
}

export interface ExtendedNuxtStore extends NuxtStore {
dynamic: boolean;
}

export interface NuxtStoreInput<
T extends State,
G,
M,
A,
S extends { [key: string]: Partial<ExtendedNuxtStore> }
S extends { [key: string]: Partial<NuxtStore> }
> {
dynamic?: boolean
strict?: boolean
Expand Down

0 comments on commit e03904d

Please sign in to comment.