Skip to content

Commit

Permalink
fix(TypeScript): Fixed compile issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jameswlane committed Dec 16, 2017
1 parent 7669c02 commit 62dc600
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/check-all-items.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export function checkAllItems(itemsGroup: any, selected: any) {
export function checkAllItems(itemsGroup: object[], selected: boolean) {
return itemsGroup.map((group: any) => {
const newItems = group.items.map(item => Object.assign({}, item, { selected }));
const numberOfSelectedItems = newItems.filter(item => item.selected === true).length;
const newItems = group.items.map((item: any) => Object.assign({}, item, { selected }));
const numberOfSelectedItems = newItems.filter((item: any) => item.selected === true).length;
const numberOfItems = newItems.length;

return Object.assign(
Expand Down
4 changes: 2 additions & 2 deletions src/check-item-by-item-number.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export function checkItemByItemNumber(itemsGroup: any, itemId: any) {
return itemsGroup.map((group) => {
return itemsGroup.map((group: any) => {
const newItems = group.items.map((item: any) => {
if (item.id === itemId) {
return Object.assign({}, item, { selected: !item.selected });
}
return item;
});
const numberOfSelectedItems = newItems.filter(item => item.selected === true).length;
const numberOfSelectedItems = newItems.filter((item: any) => item.selected === true).length;
const numberOfItems = newItems.length;
return Object.assign({}, group, {
items: newItems,
Expand Down
8 changes: 4 additions & 4 deletions src/check-items-in-group.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
export function checkItemsInGroup(itemsGroup: any, groupId: any) {
const ourGroup = itemsGroup.find(group => group.id === groupId);
const itemIds = ourGroup.items.map(item => item.id);
const ourGroup = itemsGroup.find((group: any) => group.id === groupId);
const itemIds = ourGroup.items.map((item: any) => item.id);
return itemsGroup.map((group: any) => {
const newItems = group.items.map((item) => {
const newItems = group.items.map((item: any) => {
if (itemIds.includes(item.id)) {
return Object.assign({}, item, { selected: !item.selected });
}
return item;
});
const numberOfSelectedItems = newItems.filter(item => item.selected === true).length;
const numberOfSelectedItems = newItems.filter((item: any) => item.selected === true).length;
const numberOfItems = newItems.length;

return Object.assign(
Expand Down
2 changes: 1 addition & 1 deletion src/sort-list-alphabetically.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export function sortListAlphabetically(itemsGroup: any, sortAlphabetically: any) {
return itemsGroup.sort((a, b) => {
return itemsGroup.sort((a: any, b: any) => {
const itemA = a.name.toLowerCase();
const itemB = b.name.toLowerCase();
if (itemA < itemB) {
Expand Down

0 comments on commit 62dc600

Please sign in to comment.