Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
status: StatusModel;
}
const model: StoreModel = {
todos: {
items: [],
count: selector([state => state.items], ([items]) => {
return items.length;
}),
getById: selector([state => state.items], ([items], [id]) => {
return items.find(x => x.id === id);
}),
unTypedArgs: selector([state => state.items], ([items]) => items.length),
},
status: {
totalTodos: selector(
[(state, storeState) => storeState.todos.count],
([count]) => count(),
),
},
};
const store = createStore(model);
const count = store.getState().todos.count();
count + 1;
// typings:expect-error
store.getState().todos.getById();
// typings:expect-error
interface StoreModel {
todos: TodosModel;
status: StatusModel;
}
const model: StoreModel = {
todos: {
items: [],
count: selector([state => state.items], ([items]) => {
return items.length;
}),
getById: selector([state => state.items], ([items], [id]) => {
return items.find(x => x.id === id);
}),
unTypedArgs: selector([state => state.items], ([items]) => items.length),
},
status: {
totalTodos: selector(
[(state, storeState) => storeState.todos.count],
([count]) => count(),
),
},
};
const store = createStore(model);
const count = store.getState().todos.count();
count + 1;
// typings:expect-error
number,
[SelectorRef],
[],
StoreModel
>;
}
interface StoreModel {
todos: TodosModel;
status: StatusModel;
}
const model: StoreModel = {
todos: {
items: [],
count: selector([state => state.items], ([items]) => {
return items.length;
}),
getById: selector([state => state.items], ([items], [id]) => {
return items.find(x => x.id === id);
}),
unTypedArgs: selector([state => state.items], ([items]) => items.length),
},
status: {
totalTodos: selector(
[(state, storeState) => storeState.todos.count],
([count]) => count(),
),
},
};
const store = createStore(model);
StoreModel
>;
}
interface StoreModel {
todos: TodosModel;
status: StatusModel;
}
const model: StoreModel = {
todos: {
items: [],
count: selector([state => state.items], ([items]) => {
return items.length;
}),
getById: selector([state => state.items], ([items], [id]) => {
return items.find(x => x.id === id);
}),
unTypedArgs: selector([state => state.items], ([items]) => items.length),
},
status: {
totalTodos: selector(
[(state, storeState) => storeState.todos.count],
([count]) => count(),
),
},
};
const store = createStore(model);
const count = store.getState().todos.count();