Merge branch 'next-ts-strict' into 'next'
Typescript: Start fixing strictFunctionTypes errors See merge request soapbox-pub/soapbox-fe!1143
This commit is contained in:
commit
ca68bc9df8
6 changed files with 17 additions and 7 deletions
|
@ -59,6 +59,7 @@ export function fetchInstance() {
|
||||||
return api(getState).get('/api/v1/instance').then(({ data: instance }: { data: Record<string, any> }) => {
|
return api(getState).get('/api/v1/instance').then(({ data: instance }: { data: Record<string, any> }) => {
|
||||||
dispatch({ type: INSTANCE_FETCH_SUCCESS, instance });
|
dispatch({ type: INSTANCE_FETCH_SUCCESS, instance });
|
||||||
if (needsNodeinfo(instance)) {
|
if (needsNodeinfo(instance)) {
|
||||||
|
// @ts-ignore: ???
|
||||||
dispatch(fetchNodeinfo()); // Pleroma < 2.1 backwards compatibility
|
dispatch(fetchNodeinfo()); // Pleroma < 2.1 backwards compatibility
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
@ -73,7 +74,9 @@ export function loadInstance() {
|
||||||
return (dispatch: AppDispatch, getState: () => RootState) => {
|
return (dispatch: AppDispatch, getState: () => RootState) => {
|
||||||
const host = getHost(getState());
|
const host = getHost(getState());
|
||||||
|
|
||||||
|
// @ts-ignore: ???
|
||||||
return dispatch(rememberInstance(host)).finally(() => {
|
return dispatch(rememberInstance(host)).finally(() => {
|
||||||
|
// @ts-ignore: ???
|
||||||
return dispatch(fetchInstance());
|
return dispatch(fetchInstance());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,6 +46,7 @@ const WhoToFollowPanel = ({ limit }: IWhoToFollowPanel) => {
|
||||||
{suggestionsToRender.map((suggestion: ImmutableMap<string, any>) => (
|
{suggestionsToRender.map((suggestion: ImmutableMap<string, any>) => (
|
||||||
<AccountContainer
|
<AccountContainer
|
||||||
key={suggestion.get('account')}
|
key={suggestion.get('account')}
|
||||||
|
// @ts-ignore: TS thinks `id` is passed to <Account>, but it isn't
|
||||||
id={suggestion.get('account')}
|
id={suggestion.get('account')}
|
||||||
actionIcon={require('@tabler/icons/icons/x.svg')}
|
actionIcon={require('@tabler/icons/icons/x.svg')}
|
||||||
actionTitle={intl.formatMessage(messages.dismissSuggestion)}
|
actionTitle={intl.formatMessage(messages.dismissSuggestion)}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import {
|
import {
|
||||||
Map as ImmutableMap,
|
Map as ImmutableMap,
|
||||||
List as ImmutableList,
|
List as ImmutableList,
|
||||||
|
OrderedSet as ImmutableOrderedSet,
|
||||||
fromJS,
|
fromJS,
|
||||||
} from 'immutable';
|
} from 'immutable';
|
||||||
import { AnyAction } from 'redux';
|
import { AnyAction } from 'redux';
|
||||||
|
@ -82,8 +83,8 @@ const addTags = (
|
||||||
): State => {
|
): State => {
|
||||||
return state.withMutations(state => {
|
return state.withMutations(state => {
|
||||||
accountIds.forEach(id => {
|
accountIds.forEach(id => {
|
||||||
state.updateIn([id, 'pleroma', 'tags'], ImmutableList(), (v: ImmutableList<string>) =>
|
state.updateIn([id, 'pleroma', 'tags'], ImmutableList(), v =>
|
||||||
v.toOrderedSet().union(tags).toList(),
|
ImmutableOrderedSet(fromJS(v)).union(tags).toList(),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -96,8 +97,8 @@ const removeTags = (
|
||||||
): State => {
|
): State => {
|
||||||
return state.withMutations(state => {
|
return state.withMutations(state => {
|
||||||
accountIds.forEach(id => {
|
accountIds.forEach(id => {
|
||||||
state.updateIn([id, 'pleroma', 'tags'], ImmutableList(), (v: ImmutableList<string>) =>
|
state.updateIn([id, 'pleroma', 'tags'], ImmutableList(), v =>
|
||||||
v.toOrderedSet().subtract(tags).toList(),
|
ImmutableOrderedSet(fromJS(v)).subtract(tags).toList(),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -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);
|
const appReducer = combineReducers(reducers, StateRecord);
|
||||||
|
|
||||||
// Clear the state (mostly) when the user logs out
|
// Clear the state (mostly) when the user logs out
|
||||||
|
|
|
@ -136,7 +136,9 @@ const deleteStatus = (state: State, id: string, references: Array<string>) => {
|
||||||
|
|
||||||
const importPendingStatus = (state: State, { in_reply_to_id }: APIEntity) => {
|
const importPendingStatus = (state: State, { in_reply_to_id }: APIEntity) => {
|
||||||
if (in_reply_to_id) {
|
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 {
|
} else {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -144,7 +146,9 @@ const importPendingStatus = (state: State, { in_reply_to_id }: APIEntity) => {
|
||||||
|
|
||||||
const deletePendingStatus = (state: State, { in_reply_to_id }: APIEntity) => {
|
const deletePendingStatus = (state: State, { in_reply_to_id }: APIEntity) => {
|
||||||
if (in_reply_to_id) {
|
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 {
|
} else {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"alwaysStrict": true,
|
"alwaysStrict": true,
|
||||||
"strictNullChecks": false,
|
"strictNullChecks": false,
|
||||||
"strictBindCallApply": true,
|
"strictBindCallApply": true,
|
||||||
"strictFunctionTypes": false,
|
"strictFunctionTypes": true,
|
||||||
"strictPropertyInitialization": false,
|
"strictPropertyInitialization": false,
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"noImplicitThis": true,
|
"noImplicitThis": true,
|
||||||
|
|
Loading…
Reference in a new issue