Typescript: Start fixing strictFunctionTypes errors

merge-requests/1143/head
Alex Gleason 2022-03-24 11:53:09 -05:00
rodzic 161cd3d1fc
commit 67471638c3
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
3 zmienionych plików z 12 dodań i 7 usunięć

Wyświetl plik

@ -1,6 +1,7 @@
import {
Map as ImmutableMap,
List as ImmutableList,
OrderedSet as ImmutableOrderedSet,
fromJS,
} from 'immutable';
import { AnyAction } from 'redux';
@ -82,8 +83,8 @@ const addTags = (
): State => {
return state.withMutations(state => {
accountIds.forEach(id => {
state.updateIn([id, 'pleroma', 'tags'], ImmutableList(), (v: ImmutableList<string>) =>
v.toOrderedSet().union(tags).toList(),
state.updateIn([id, 'pleroma', 'tags'], ImmutableList(), v =>
ImmutableOrderedSet(fromJS(v)).union(tags).toList(),
);
});
});
@ -96,8 +97,8 @@ const removeTags = (
): State => {
return state.withMutations(state => {
accountIds.forEach(id => {
state.updateIn([id, 'pleroma', 'tags'], ImmutableList(), (v: ImmutableList<string>) =>
v.toOrderedSet().subtract(tags).toList(),
state.updateIn([id, 'pleroma', 'tags'], ImmutableList(), v =>
ImmutableOrderedSet(fromJS(v)).subtract(tags).toList(),
);
});
});

Wyświetl plik

@ -136,7 +136,9 @@ const deleteStatus = (state: State, id: string, references: Array<string>) => {
const importPendingStatus = (state: State, { in_reply_to_id }: APIEntity) => {
if (in_reply_to_id) {
return state.updateIn([in_reply_to_id, 'replies_count'], 0, (count: number) => count + 1);
return state.updateIn([in_reply_to_id, 'replies_count'], 0, count => {
return typeof count === 'number' ? count + 1 : 0;
});
} else {
return state;
}
@ -144,7 +146,9 @@ const importPendingStatus = (state: State, { in_reply_to_id }: APIEntity) => {
const deletePendingStatus = (state: State, { in_reply_to_id }: APIEntity) => {
if (in_reply_to_id) {
return state.updateIn([in_reply_to_id, 'replies_count'], 0, (count: number) => Math.max(0, count - 1));
return state.updateIn([in_reply_to_id, 'replies_count'], 0, count => {
return typeof count === 'number' ? Math.max(0, count - 1) : 0;
});
} else {
return state;
}

Wyświetl plik

@ -5,7 +5,7 @@
"alwaysStrict": true,
"strictNullChecks": false,
"strictBindCallApply": true,
"strictFunctionTypes": false,
"strictFunctionTypes": true,
"strictPropertyInitialization": false,
"noImplicitAny": true,
"noImplicitThis": true,