You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a new Vue 2 project with typescript support using Vue CLI. Install pinia and composition api npm install pinia @vue/composition-api and set skipLibCheck in tsconfig.json to false e.g. "skipLibCheck": false
Run npm run serve
Expected behavior
Expected project to compile without any typescript errors.
Actual behavior
Got the following errors:
ERROR in D:/Temp/test/testvue/node_modules/pinia/dist/src/types.d.ts(143,108):
143:108 Type 'Record<string, (() => any) | ((state: UnwrapRef<S & PiniaCustomStateProperties<S>>) => any)>' does not satisfy the constraint 'Record<string, (() => any) | ((state: { [x: string]: any; [x: number]: any; }) => any)>'.
Index signatures are incompatible.
Type '(() => any) | ((state: UnwrapRef<S & PiniaCustomStateProperties<S>>) => any)' is not assignable to type '(() => any) | ((state: { [x: string]: any; [x: number]: any; }) => any)'.
Type '(state: UnwrapRef<S & PiniaCustomStateProperties<S>>) => any' is not assignable to type '(() => any) | ((state: { [x: string]: any; [x: number]: any; }) => any)'.
Type '(state: UnwrapRef<S & PiniaCustomStateProperties<S>>) => any' is not assignable to type '() => any'.
141 | * @internal
142 | */
> 143 | export interface StoreWithState<Id extends string, S extends StateTree, G extends GettersTree<StateTree> = GettersTree<S>, A = ActionsTree> {
| ^
144 | /**
145 | * Unique identifier of the store
146 | */
ERROR in D:/Temp/test/testvue/node_modules/pinia/dist/src/types.d.ts(253,199):
253:199 Type 'G' does not satisfy the constraint 'Record<string, (() => any) | ((state: { [x: string]: any; [x: number]: any; }) => any)>'.
Type 'Record<string, (() => any) | ((state: UnwrapRef<S & PiniaCustomStateProperties<S>>) => any)>' is not assignable to type 'Record<string, (() => any) | ((state: { [x: string]: any; [x: number]: any; }) => any)>'.
Index signatures are incompatible.
Type '(() => any) | ((state: UnwrapRef<S & PiniaCustomStateProperties<S>>) => any)' is not assignable to type '(() => any) | ((state: { [x: string]: any; [x: number]: any; }) => any)'.
Type '(state: UnwrapRef<S & PiniaCustomStateProperties<S>>) => any' is not assignable to type '(() => any) | ((state: { [x: string]: any; [x: number]: any; }) => any)'.
Type '(state: UnwrapRef<S & PiniaCustomStateProperties<S>>) => any' is not assignable to type '() => any'.
251 | * Store type to build a store
252 | */
> 253 | export declare type Store<Id extends string = string, S extends StateTree = StateTree, G extends GettersTree<S> = GettersTree<S>, A = ActionsTree> = StoreWithState<Id, StateTree extends S ? {} : S, G, A> & (StateTree extends S ? {} : UnwrapRef<S>) & (GettersTree<S> extends G ? {} : StoreWithGetters<G>) & (ActionsTree extends A ? {} : StoreWithActions<A>) & PiniaCustomProperties<Id, S, G, A> & PiniaCustomStateProperties<S>;
| ^
254 | /**
255 | * Generic and type-unsafe version of Store. Doesn't fail on access with
256 | * strings, making it much easier to write generic functions that do not care
ERROR in D:/Temp/test/testvue/node_modules/pinia/dist/src/types.d.ts(259,179):
259:179 Type 'G' does not satisfy the constraint 'Record<string, (() => any) | ((state: { [x: string]: any; [x: number]: any; }) => any)>'.
Type 'Record<string, (() => any) | ((state: UnwrapRef<S & PiniaCustomStateProperties<S>>) => any)>' is not assignable to type 'Record<string, (() => any) | ((state: { [x: string]: any; [x: number]: any; }) => any)>'.
Index signatures are incompatible.
Type '(() => any) | ((state: UnwrapRef<S & PiniaCustomStateProperties<S>>) => any)' is not assignable to type '(() => any) | ((state: { [x: string]: any; [x: number]: any; }) => any)'.
Type '(state: UnwrapRef<S & PiniaCustomStateProperties<S>>) => any' is not assignable to type '(() => any) | ((state: { [x: string]: any; [x: number]: any; }) => any)'.
Type '(state: UnwrapRef<S & PiniaCustomStateProperties<S>>) => any' is not assignable to type '() => any'.
257 | * about the kind of store that is passed.
258 | */
> 259 | export declare type GenericStore<Id extends string = string, S extends StateTree = StateTree, G extends GettersTree<S> = GettersTree<S>, A = ActionsTree> = StoreWithState<Id, S, G, A> & UnwrapRef<S> & StoreWithGetters<G> & StoreWithActions<A> & PiniaCustomProperties<Id, S, G, A> & PiniaCustomStateProperties<S>;
| ^
260 | /**
261 | * Return type of `defineStore()`. Function that allows instantiating a store.
262 | */
ERROR in D:/Temp/test/testvue/node_modules/pinia/dist/src/types.d.ts(315,69):
315:69 Type 'G' does not satisfy the constraint 'Record<string, (() => any) | ((state: { [x: string]: any; [x: number]: any; }) => any)>'.
Type 'Record<string, (() => any) | ((state: UnwrapRef<S & PiniaCustomStateProperties<S>>) => any)>' is not assignable to type 'Record<string, (() => any) | ((state: { [x: string]: any; [x: number]: any; }) => any)>'.
Index signatures are incompatible.
Type '(() => any) | ((state: UnwrapRef<S & PiniaCustomStateProperties<S>>) => any)' is not assignable to type '(() => any) | ((state: { [x: string]: any; [x: number]: any; }) => any)'.
Type '(state: UnwrapRef<S & PiniaCustomStateProperties<S>>) => any' is not assignable to type '(() => any) | ((state: { [x: string]: any; [x: number]: any; }) => any)'.
Type '(state: UnwrapRef<S & PiniaCustomStateProperties<S>>) => any' is not assignable to type '() => any'.
313 | * Optional object of actions.
314 | */
> 315 | actions?: A & ThisType<A & UnwrapRef<S> & StoreWithState<Id, S, G, A> & StoreWithGetters<G> & PiniaCustomProperties & PiniaCustomStateProperties>;
| ^
316 | }
317 | //# sourceMappingURL=types.d.ts.map
Version: typescript 4.1.5
Reproduction
Create a new Vue 2 project with typescript support using Vue CLI. Install pinia and composition api
npm install pinia @vue/composition-api
and setskipLibCheck
in tsconfig.json tofalse
e.g."skipLibCheck": false
Run
npm run serve
Expected behavior
Expected project to compile without any typescript errors.
Actual behavior
Got the following errors:
Additional information
Using typescript 4.1.5
Dependencies:
The text was updated successfully, but these errors were encountered: