nartc / ngrx-slice Goto Github PK
View Code? Open in Web Editor NEWMoved to https://github.com/nartc/nartc-workspace
Home Page: https://ngrx-slice.netlify.app/
License: MIT License
Moved to https://github.com/nartc/nartc-workspace
Home Page: https://ngrx-slice.netlify.app/
License: MIT License
Hello,
We are using ngrx-slice in our application and it is a blast!
But we are facing a weird problem. We mainly use yarn, but for some reason, yarn is very slow on our machine, we decided to try npm and pnpm for managing dependencies.
Normally, the code is working fine if we run yarn install
. But when we try to install the dependencies, ngrx-slice is giving an error, saying that it can't find the actions and reducers inside the slice.
Here is the code that is using ngrx-slice:
import { createSlice, PayloadAction } from "ngrx-slice";
export interface KullaniciState {
tcKimlikNumarasi: string;
hesapAktifMi: boolean;
kayitliKullaniciMi: boolean;
yetkiler: string[];
}
export const kullaniciInitialState: KullaniciState = {
tcKimlikNumarasi: "",
hesapAktifMi: false,
kayitliKullaniciMi: false,
yetkiler: []
};
const slice = createSlice({
name: "kullanici",
initialState: kullaniciInitialState,
reducers: {
kullaniciBilgileriEkle(state, payload: PayloadAction<KullaniciState>) {
state.tcKimlikNumarasi = payload.tcKimlikNumarasi;
state.yetkiler = payload.yetkiler;
state.hesapAktifMi = payload.hesapAktifMi;
state.kayitliKullaniciMi = payload.kayitliKullaniciMi;
}
}
});
export const KullaniciActions = slice.KullaniciActions;
export const KullaniciSelectors = slice.KullaniciSelectors;
export const KullaniciFeature = slice.KullaniciFeature;
This is a very generic slice, nothing too fancy.
When we compile the code, it is giving me this error, saying that it can't find the KullaniciActions:
Error: apps/tenmak/src/app/store/kullanici-slice/kullanici.slice.ts:31:39 - error TS2339: Property 'KullaniciActions' does not exist on type 'Slice<Record<string, any>, "kullanici", KullaniciState, { kullaniciBilgileriEkle(state: Wr
itableDraft<KullaniciState>, payload: PayloadAction<...>): void; }>'.
31 export const KullaniciActions = slice.KullaniciActions;
~~~~~~~~~~~~~~~~
Error: kullanici.slice.ts:32:41 - error TS2339: Property 'KullaniciSelectors' does not exist on type 'Slice<Record<string, any>, "kullanici", KullaniciState, { kullaniciBilgileriEkle(state:
WritableDraft<KullaniciState>, payload: PayloadAction<...>): void; }>'.
32 export const KullaniciSelectors = slice.KullaniciSelectors;
~~~~~~~~~~~~~~~~~~
Error: kullanici.slice.ts:33:39 - error TS2339: Property 'KullaniciFeature' does not exist on type 'Slice<Record<string, any>, "kullanici", KullaniciState, { kullaniciBilgileriEkle(state: Wr
itableDraft<KullaniciState>, payload: PayloadAction<...>): void; }>'.
33 export const KullaniciFeature = slice.KullaniciFeature;
~~~~~~~~~~~~~~~~
Here is the error whenever I hover over the error in IntelliJ:
The error goes away when we install the dependencies with yarn.
I even managed to reproduce the error, which was surprising. Here is a repository:
https://github.com/fatihdogmus/ngrx-slice-error-repo
Environment:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.