diff --git a/app/soapbox/actions/instance.ts b/app/soapbox/actions/instance.ts index 150e9cc86..1c826e3d2 100644 --- a/app/soapbox/actions/instance.ts +++ b/app/soapbox/actions/instance.ts @@ -59,6 +59,7 @@ export function fetchInstance() { return api(getState).get('/api/v1/instance').then(({ data: instance }: { data: Record }) => { dispatch({ type: INSTANCE_FETCH_SUCCESS, instance }); if (needsNodeinfo(instance)) { + // @ts-ignore: ??? dispatch(fetchNodeinfo()); // Pleroma < 2.1 backwards compatibility } }).catch(error => { @@ -73,7 +74,9 @@ export function loadInstance() { return (dispatch: AppDispatch, getState: () => RootState) => { const host = getHost(getState()); + // @ts-ignore: ??? return dispatch(rememberInstance(host)).finally(() => { + // @ts-ignore: ??? return dispatch(fetchInstance()); }); }; diff --git a/app/soapbox/features/ui/components/who-to-follow-panel.tsx b/app/soapbox/features/ui/components/who-to-follow-panel.tsx index 09b55999a..d55f04585 100644 --- a/app/soapbox/features/ui/components/who-to-follow-panel.tsx +++ b/app/soapbox/features/ui/components/who-to-follow-panel.tsx @@ -46,6 +46,7 @@ const WhoToFollowPanel = ({ limit }: IWhoToFollowPanel) => { {suggestionsToRender.map((suggestion: ImmutableMap) => ( , but it isn't id={suggestion.get('account')} actionIcon={require('@tabler/icons/icons/x.svg')} actionTitle={intl.formatMessage(messages.dismissSuggestion)} diff --git a/app/soapbox/reducers/accounts.ts b/app/soapbox/reducers/accounts.ts index cea4603af..bb9458cf1 100644 --- a/app/soapbox/reducers/accounts.ts +++ b/app/soapbox/reducers/accounts.ts @@ -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) => - 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) => - v.toOrderedSet().subtract(tags).toList(), + state.updateIn([id, 'pleroma', 'tags'], ImmutableList(), v => + ImmutableOrderedSet(fromJS(v)).subtract(tags).toList(), ); }); }); diff --git a/app/soapbox/reducers/index.ts b/app/soapbox/reducers/index.ts index 19d9930c0..4e54ec19f 100644 --- a/app/soapbox/reducers/index.ts +++ b/app/soapbox/reducers/index.ts @@ -128,6 +128,7 @@ export const StateRecord = ImmutableRecord( }, {}), ); +// @ts-ignore: This type is fine but TS thinks it's wrong const appReducer = combineReducers(reducers, StateRecord); // Clear the state (mostly) when the user logs out diff --git a/app/soapbox/reducers/statuses.ts b/app/soapbox/reducers/statuses.ts index 404094b95..c115a9089 100644 --- a/app/soapbox/reducers/statuses.ts +++ b/app/soapbox/reducers/statuses.ts @@ -136,7 +136,9 @@ const deleteStatus = (state: State, id: string, references: Array) => { 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; } diff --git a/tsconfig.json b/tsconfig.json index b961c4bcb..8412a8997 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,7 @@ "alwaysStrict": true, "strictNullChecks": false, "strictBindCallApply": true, - "strictFunctionTypes": false, + "strictFunctionTypes": true, "strictPropertyInitialization": false, "noImplicitAny": true, "noImplicitThis": true,