-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
From Where I need to import the ZustandBaseService #11
Comments
you should be able to import it from the lib.| |
How can I use the persist store for this I tried but I end up with lots of an errors, could you please help me @JoaoPauloLousada |
import { Injectable } from '@angular/core';
import { ZustandBaseService } from 'ngx-zustand';
interface CounterState {
counter: number;
increment: () => void;
decrement: () => void;
}
@Injectable({
providedIn: 'root',
})
export class CounterService extends ZustandBaseService<CounterState> {
initStore() {
return set => ({
counter: 0,
increment: () => set(state => ({ counter: state.counter + 1 })),
decrement: () => set(state => ({ counter: state.counter - 1 })),
});
}
}
Error: node_modules/ngx-zustand/lib/zustand-base.service.d.ts:13:53 - error TS1005: '>' expected.
13 useStore<S>(selector: Parameters<typeof useStore<T, S>>[1]): Observable<S>;
~
Error: node_modules/ngx-zustand/lib/zustand-base.service.d.ts:13:58 - error TS1005: ',' expected.
13 useStore<S>(selector: Parameters<typeof useStore<T, S>>[1]): Observable<S>;
~
Error: node_modules/ngx-zustand/lib/zustand-base.service.d.ts:13:60 - error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
13 useStore<S>(selector: Parameters<typeof useStore<T, S>>[1]): Observable<S>;
~~~
Error: node_modules/ngx-zustand/lib/zustand-base.service.d.ts:13:63 - error TS1005: ';' expected.
13 useStore<S>(selector: Parameters<typeof useStore<T, S>>[1]): Observable<S>;
~
Error: node_modules/ngx-zustand/lib/zustand-base.service.d.ts:13:64 - error TS1128: Declaration or statement expected.
13 useStore<S>(selector: Parameters<typeof useStore<T, S>>[1]): Observable<S>;
~
Error: node_modules/ngx-zustand/lib/zustand-base.service.d.ts:13:66 - error TS2348: Value of type 'typeof Observable' is not callable. Did you mean to include 'new'?
13 useStore<S>(selector: Parameters<typeof useStore<T, S>>[1]): Observable<S>;
~~~~~~~~~~~~~
Error: node_modules/ngx-zustand/lib/zustand-base.service.d.ts:13:77 - error TS2304: Cannot find name 'S'.
13 useStore<S>(selector: Parameters<typeof useStore<T, S>>[1]): Observable<S>;
~
Error: node_modules/ngx-zustand/lib/zustand-base.service.d.ts:13:79 - error TS1005: '(' expected.
13 useStore<S>(selector: Parameters<typeof useStore<T, S>>[1]): Observable<S>;
~
Error: node_modules/ngx-zustand/lib/zustand-base.service.d.ts:14:1 - error TS1128: Declaration or statement expected.
14 }
|
This seems to be a TypeScript issue @Syammed2429 - check your compiler version and check if it's up to date. Seems duplicate of #10 |
@Marcial1234 please feel free to contribute to the project :) |
I did something like that , but it's throwing an error like
Cannot find name 'ZustandBaseService'.ts(2304)
so from where I can import it??The text was updated successfully, but these errors were encountered: