Closed thomas-ama closed 5 years ago
@markwhitfeld should we close this?
I think we need to improve docs for this
@thomas-ama You're saying that:
The problem is that the state variable has no types: no type checks, no auto-completion, etc
It can't. You also can't create an interface for that as your feature states may not be initialized at this moment. And also I'd ask what is the motivation of using the callback function? IMHO that's much better to provide a state class as an argument or static selector. I've never used such approach as there is no need. :relieved:
You probably defined a AppState interface that represents the global state graph
This is just a semantic overview of the global graph and it doesn't force you to create an interface for the global state :wink:
But yes need to rephrase it.
And also I'd ask what is the motivation of using the callback function? IMHO that's much better to provide a state class as an argument or static selector. I've never used such approach as there is no need. π
Indeed, over time I understood that using selectors brought many advantages, including typing!
About typing, here is a message from Mark from NGXS Slack:
We will be adding a lot of type safety in v4 because a lot of it requires an upgrade to Typescript 3. In NGXS v3 we are committed to be backward compatible to TS 2.5
Released in 3.5.0
I'm submitting a...
Current behavior
Hello,
My team and I have been using NGXS for a few days. I have read all the documentation on the website. It is rather complete and well written overall!
However, the part on lazy-loading is a little ambiguous. In particular, the following paragraph:
export interface OfficesStateModel extends AppStateModel { offices: Office[]; }
{ appState: {}, officesState: {} }
{ appState: { officesState: {} } }
appState: { officesState: {} }