Compare commits

...

4 Commits

Author SHA1 Message Date
9413c5bcdc 1.0.19 2020-11-29 23:31:32 +00:00
1d5fb320f4 fix(core): update 2020-11-29 23:31:31 +00:00
69e905ad76 1.0.18 2020-11-29 23:28:45 +00:00
7b9ed9ee78 fix(core): update 2020-11-29 23:28:44 +00:00
3 changed files with 5 additions and 4 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartstate",
"version": "1.0.17",
"version": "1.0.19",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartstate",
"version": "1.0.17",
"version": "1.0.19",
"private": false,
"description": "a package that handles state in a good way",
"main": "dist_ts/index.js",

View File

@ -11,10 +11,11 @@ export class Smartstate<StatePartNameType> {
public getStatePart<PayloadType>(
statePartNameArg: string & StatePartNameType,
initialArg?: PayloadType
initialArg?: PayloadType,
initMode?: 'soft' | 'mandatory'
): StatePart<StatePartNameType, PayloadType> {
if (this.statePartMap[statePartNameArg as any]) {
if (initialArg) {
if (initialArg && (!initMode || initMode !== 'soft')) {
throw new Error(
`${statePartNameArg} already exists, yet you try to set an initial state again`
);