Convert features/status/index to typescript (pretty much)
This commit is contained in:
parent
c51441c026
commit
fdb44d615d
5 changed files with 9 additions and 9 deletions
|
@ -16,7 +16,7 @@ const listenerOptions = supportsPassiveEvents ? { passive: true } : false;
|
|||
let id = 0;
|
||||
|
||||
export interface MenuItem {
|
||||
action: React.EventHandler<React.KeyboardEvent | React.MouseEvent>,
|
||||
action?: React.EventHandler<React.KeyboardEvent | React.MouseEvent>,
|
||||
middleClick?: React.EventHandler<React.MouseEvent>,
|
||||
text: string,
|
||||
href?: string,
|
||||
|
|
|
@ -4,7 +4,6 @@ import PTRComponent from 'react-simple-pull-to-refresh';
|
|||
import { Spinner } from 'soapbox/components/ui';
|
||||
|
||||
interface IPullToRefresh {
|
||||
children: JSX.Element & React.ReactNode,
|
||||
onRefresh?: () => Promise<any>
|
||||
}
|
||||
|
||||
|
@ -12,7 +11,7 @@ interface IPullToRefresh {
|
|||
* PullToRefresh:
|
||||
* Wrapper around a third-party PTR component with Soapbox defaults.
|
||||
*/
|
||||
const PullToRefresh = ({ children, onRefresh, ...rest }: IPullToRefresh) => {
|
||||
const PullToRefresh: React.FC<IPullToRefresh> = ({ children, onRefresh, ...rest }): JSX.Element => {
|
||||
const handleRefresh = () => {
|
||||
if (onRefresh) {
|
||||
return onRefresh();
|
||||
|
@ -33,7 +32,8 @@ const PullToRefresh = ({ children, onRefresh, ...rest }: IPullToRefresh) => {
|
|||
resistance={2}
|
||||
{...rest}
|
||||
>
|
||||
{children}
|
||||
{/* This thing really wants a single JSX element as its child (TypeScript), so wrap it in one */}
|
||||
<>{children}</>
|
||||
</PTRComponent>
|
||||
);
|
||||
};
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -98,12 +98,12 @@ const toServerSideType = (columnType: string): string => {
|
|||
}
|
||||
};
|
||||
|
||||
type FilterContext = { contextType: string };
|
||||
type FilterContext = { contextType?: string };
|
||||
|
||||
export const getFilters = (state: RootState, { contextType }: FilterContext) => {
|
||||
export const getFilters = (state: RootState, query: FilterContext) => {
|
||||
return state.filters.filter((filter): boolean => {
|
||||
return contextType
|
||||
&& filter.get('context').includes(toServerSideType(contextType))
|
||||
return query?.contextType
|
||||
&& filter.get('context').includes(toServerSideType(query.contextType))
|
||||
&& (filter.get('expires_at') === null
|
||||
|| Date.parse(filter.get('expires_at')) > new Date().getTime());
|
||||
});
|
||||
|
@ -132,7 +132,7 @@ export const regexFromFilters = (filters: ImmutableList<ImmutableMap<string, any
|
|||
}).join('|'), 'i');
|
||||
};
|
||||
|
||||
type APIStatus = { id: string, username: string };
|
||||
type APIStatus = { id: string, username?: string };
|
||||
|
||||
export const makeGetStatus = () => {
|
||||
return createSelector(
|
||||
|
|
Loading…
Reference in a new issue