mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-23 22:18:36 -05:00
Merge pull request #3310 from inaturalist/mob-1043-lint-rule-for-enforcing-consistent-array-type-definition
Mob 1043 lint rule for enforcing consistent array type definition
This commit is contained in:
@@ -129,6 +129,9 @@ module.exports = {
|
||||
// https://eslint.org/docs/latest/rules/no-undef#handled_by_typescript
|
||||
"no-undef": "error",
|
||||
|
||||
"@typescript-eslint/array-type": ["error", {
|
||||
default: "array",
|
||||
}],
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
|
||||
@@ -65,12 +65,12 @@ export interface ErrorWithResponse {
|
||||
url: string;
|
||||
json: () => Promise<{
|
||||
status: string;
|
||||
errors: Array<{
|
||||
errors: {
|
||||
errorCode: string;
|
||||
message: string;
|
||||
from: string | null;
|
||||
stack: string | null;
|
||||
}>;
|
||||
}[];
|
||||
}>;
|
||||
};
|
||||
status?: number;
|
||||
|
||||
@@ -66,10 +66,10 @@ const fetchRemoteObservation = async (
|
||||
};
|
||||
|
||||
const fetchRemoteObservations = async (
|
||||
uuids: Array<string>,
|
||||
uuids: string[],
|
||||
params: Object = {},
|
||||
opts: Object = {},
|
||||
): Promise<?Array<Object>> => {
|
||||
): Promise<?Object[]> => {
|
||||
try {
|
||||
const response = await inatjs.observations.fetch(
|
||||
uuids,
|
||||
|
||||
@@ -5,7 +5,7 @@ import inatjs from "inaturalistjs";
|
||||
import handleError from "./error";
|
||||
|
||||
const fetchPlace = async (
|
||||
id: number | Array<number>,
|
||||
id: number | number[],
|
||||
params: Object = {},
|
||||
opts: Object = {},
|
||||
): Promise<?Object> => {
|
||||
|
||||
@@ -47,7 +47,7 @@ function mapToLocalSchema( taxon ) {
|
||||
}
|
||||
|
||||
async function fetchTaxon(
|
||||
id: number | Array<number>,
|
||||
id: number | number[],
|
||||
params: Object = {},
|
||||
opts: Object = {},
|
||||
): Promise<?Object> {
|
||||
|
||||
@@ -71,7 +71,7 @@ const fetchRemoteUser = async (
|
||||
};
|
||||
|
||||
const fetchUsers = async (
|
||||
ids: Array<number>,
|
||||
ids: number[],
|
||||
params: Object = {},
|
||||
opts: Object = {},
|
||||
): Promise<?Object> => {
|
||||
|
||||
@@ -21,7 +21,7 @@ const logger = log.extend( "App" );
|
||||
|
||||
type SharedItem = {
|
||||
mimeType: string,
|
||||
data: string | Array<string>
|
||||
data: string | string[]
|
||||
};
|
||||
|
||||
const handleShare = ( navigation, item: ?SharedItem ) => {
|
||||
|
||||
@@ -21,7 +21,7 @@ interface Props {
|
||||
takingPhoto: boolean;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
takePhotoAndStoreUri: Function;
|
||||
newPhotoUris: Array<object>;
|
||||
newPhotoUris: object[];
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
setNewPhotoUris: Function;
|
||||
takePhotoOptions: object;
|
||||
|
||||
@@ -53,7 +53,7 @@ type Props = {
|
||||
takingPhoto: boolean,
|
||||
takePhotoAndStoreUri: Function,
|
||||
takePhotoOptions: Object,
|
||||
newPhotoUris: Array<Object>,
|
||||
newPhotoUris: Object[],
|
||||
setNewPhotoUris: Function
|
||||
};
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import { useTranslation } from "sharedHooks";
|
||||
type Props = {
|
||||
canFetch?: boolean,
|
||||
contentContainerStyle?: Object,
|
||||
data: Array<Object>,
|
||||
data: Object[],
|
||||
fetchNextPage: boolean,
|
||||
hideLoadingWheel: boolean,
|
||||
isFetchingNextPage: boolean,
|
||||
|
||||
@@ -57,7 +57,7 @@ type FullPageWebViewParams = {
|
||||
title?: string;
|
||||
loggedIn?: boolean;
|
||||
skipSetSourceInShouldStartLoadWithRequest?: boolean;
|
||||
clickablePathnames?: Array<string>;
|
||||
clickablePathnames?: string[];
|
||||
shouldLoadUrl?: ( url: string ) => boolean;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,16 +31,16 @@ type Props = {
|
||||
onDeletePhoto?: Function,
|
||||
onClose?: Function,
|
||||
onDeleteSound?: Function,
|
||||
photos: Array<{
|
||||
photos: {
|
||||
id?: number,
|
||||
url: string,
|
||||
localFilePath?: string,
|
||||
attribution?: string,
|
||||
licenseCode?: string
|
||||
}>,
|
||||
sounds?: Array<{
|
||||
}[],
|
||||
sounds?: {
|
||||
file_url: string
|
||||
}>,
|
||||
}[],
|
||||
selectedMediaIndex: number,
|
||||
setSelectedMediaIndex: Function
|
||||
}
|
||||
|
||||
@@ -13,18 +13,18 @@ import useTranslation from "sharedHooks/useTranslation";
|
||||
|
||||
type Props = {
|
||||
isLargeScreen?: boolean,
|
||||
photos: Array<{
|
||||
photos: {
|
||||
id?: number,
|
||||
url: string,
|
||||
localFilePath?: string,
|
||||
attribution?: string,
|
||||
licenseCode?: string
|
||||
}>,
|
||||
}[],
|
||||
scrollToIndex: Function,
|
||||
selectedMediaIndex?: number,
|
||||
sounds?: Array<{
|
||||
sounds?: {
|
||||
file_url: string
|
||||
}>,
|
||||
}[],
|
||||
}
|
||||
|
||||
const SMALL_ITEM_CLASS = "rounded-sm w-[42px] h-[42px] mx-[6px] my-[12px]";
|
||||
|
||||
@@ -30,16 +30,16 @@ type Props = {
|
||||
onClose?: Function,
|
||||
onDeletePhoto?: Function,
|
||||
onDeleteSound?: Function,
|
||||
photos?: Array<{
|
||||
photos?: {
|
||||
id?: number,
|
||||
url: string,
|
||||
localFilePath?: string,
|
||||
attribution?: string,
|
||||
licenseCode?: string
|
||||
}>,
|
||||
sounds?: Array<{
|
||||
}[],
|
||||
sounds?: {
|
||||
file_url: string
|
||||
}>,
|
||||
}[],
|
||||
uri?: string | null
|
||||
}
|
||||
|
||||
|
||||
@@ -14,16 +14,16 @@ type Props = {
|
||||
onClose?: Function,
|
||||
onDeletePhoto?: Function,
|
||||
onDeleteSound?: Function,
|
||||
photos?: Array<{
|
||||
photos?: {
|
||||
id?: number,
|
||||
url: string,
|
||||
localFilePath?: string,
|
||||
attribution?: string,
|
||||
licenseCode?: string
|
||||
}>,
|
||||
sounds?: Array<{
|
||||
}[],
|
||||
sounds?: {
|
||||
file_url: string
|
||||
}>,
|
||||
}[],
|
||||
showModal: boolean,
|
||||
uri?: string | null
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ const MyObservationsContainer = ( ): React.FC => {
|
||||
const [activeTab, setActiveTab] = useState( OBSERVATIONS_TAB );
|
||||
|
||||
let numTotalTaxaLocal: number | undefined;
|
||||
const localObservedSpeciesCount: Array<SpeciesCount> = [];
|
||||
const localObservedSpeciesCount: SpeciesCount[] = [];
|
||||
if ( !currentUser ) {
|
||||
// Calculate obs and leaf taxa counts from local observations
|
||||
const distinctTaxonObs = realm.objects<RealmObservation>( "Observation" )
|
||||
|
||||
@@ -11,7 +11,7 @@ import ActivityItem from "./ActivityItem";
|
||||
type Props = {
|
||||
observation:Object,
|
||||
refetchRemoteObservation: Function,
|
||||
activityItems: Array<Object>,
|
||||
activityItems: Object[],
|
||||
openAgreeWithIdSheet: Function,
|
||||
isConnected: boolean,
|
||||
targetItemID: number,
|
||||
|
||||
@@ -14,12 +14,12 @@ const sectionClass = "mx-[15px] mb-[20px]";
|
||||
// TODO: can we get a centralized type/interface for our realm objects, here observation and project
|
||||
interface Props {
|
||||
observation: {
|
||||
project_observations: Array<{
|
||||
project_observations: {
|
||||
project: object;
|
||||
}>;
|
||||
non_traditional_projects: Array<{
|
||||
}[];
|
||||
non_traditional_projects: {
|
||||
project: object;
|
||||
}>;
|
||||
}[];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import SuggestIDSheet from "./Sheets/SuggestIDSheet";
|
||||
const isTablet = DeviceInfo.isTablet();
|
||||
|
||||
type Props = {
|
||||
activityItems: Array<Object>,
|
||||
activityItems: Object[],
|
||||
addingActivityItem: Function,
|
||||
closeAgreeWithIdSheet: Function,
|
||||
belongsToCurrentUser: boolean,
|
||||
@@ -63,7 +63,7 @@ type Props = {
|
||||
showSuggestIdSheet: boolean,
|
||||
subscriptions?: Object,
|
||||
suggestIdSheetDiscardChanges: Function,
|
||||
tabs: Array<Object>,
|
||||
tabs: Object[],
|
||||
identBodySheetShown?: boolean,
|
||||
onCloseIdentBodySheet?: Function,
|
||||
newIdentification?: null | {
|
||||
|
||||
@@ -12,16 +12,16 @@ import SoundContainer from "./SoundContainer";
|
||||
|
||||
type Props = {
|
||||
loading: boolean,
|
||||
photos: Array<{
|
||||
photos: {
|
||||
id?: number,
|
||||
url: string,
|
||||
localFilePath?: string,
|
||||
attribution?: string,
|
||||
licenseCode?: string
|
||||
}>,
|
||||
sounds?: Array<{
|
||||
}[],
|
||||
sounds?: {
|
||||
file_url: string
|
||||
}>,
|
||||
}[],
|
||||
tablet: boolean
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ import ObsMedia from "./ObsMedia";
|
||||
|
||||
type Props = {
|
||||
loading: boolean,
|
||||
photos: Array<Object>,
|
||||
sounds: Array<Object>,
|
||||
photos: Object[],
|
||||
sounds: Object[],
|
||||
tablet: boolean
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import ActivityItem from "./ActivityItem";
|
||||
type Props = {
|
||||
observation:Object,
|
||||
refetchRemoteObservation: Function,
|
||||
activityItems: Array<Object>,
|
||||
activityItems: Object[],
|
||||
openAgreeWithIdSheet: Function,
|
||||
isConnected: boolean,
|
||||
targetItemID: ?number,
|
||||
|
||||
@@ -6,12 +6,12 @@ import React, { useMemo } from "react";
|
||||
// TODO: can we get a centralized type/interface for our realm objects, here observation and project
|
||||
interface Props {
|
||||
observation: {
|
||||
project_observations: Array<{
|
||||
project_observations: {
|
||||
project: object;
|
||||
}>;
|
||||
non_traditional_projects: Array<{
|
||||
}[];
|
||||
non_traditional_projects: {
|
||||
project: object;
|
||||
}>;
|
||||
}[];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import StatusSection from "./StatusSection/StatusSection";
|
||||
const cardClassBottom = "rounded-b-2xl border-lightGray border-[2px] pb-3 border-t-0 -mt-0.5 mb-4";
|
||||
|
||||
type Props = {
|
||||
activityItems: Array<object>;
|
||||
activityItems: object[];
|
||||
addingActivityItem: boolean;
|
||||
belongsToCurrentUser: boolean;
|
||||
currentUser: RealmUser;
|
||||
|
||||
@@ -11,16 +11,16 @@ import SoundContainer from "./SoundContainer";
|
||||
|
||||
type Props = {
|
||||
loading: boolean,
|
||||
photos: Array<{
|
||||
photos: {
|
||||
id?: number,
|
||||
url: string,
|
||||
localFilePath?: string,
|
||||
attribution?: string,
|
||||
licenseCode?: string
|
||||
}>,
|
||||
sounds?: Array<{
|
||||
}[],
|
||||
sounds?: {
|
||||
file_url: string
|
||||
}>
|
||||
}[]
|
||||
}
|
||||
|
||||
const ObsMedia = ( {
|
||||
|
||||
@@ -16,8 +16,8 @@ import ObsMedia from "./ObsMedia";
|
||||
|
||||
type Props = {
|
||||
loading: boolean,
|
||||
photos: Array<Object>,
|
||||
sounds: Array<Object>
|
||||
photos: Object[],
|
||||
sounds: Object[]
|
||||
}
|
||||
|
||||
const ObsMediaDisplay = ( {
|
||||
|
||||
@@ -22,7 +22,7 @@ const { useRealm } = RealmContext;
|
||||
|
||||
type Props = {
|
||||
passesEvidenceTest: boolean;
|
||||
observations: Array<object>;
|
||||
observations: object[];
|
||||
currentObservation: RealmObservation;
|
||||
currentObservationIndex: number;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
|
||||
@@ -27,13 +27,13 @@ const logger = log.extend( "EvidenceList" );
|
||||
|
||||
type Props = {
|
||||
handleAddEvidence?: Function,
|
||||
observationSounds?: Array<{
|
||||
observationSounds?: {
|
||||
id?: number,
|
||||
sound: {
|
||||
file_url: string,
|
||||
},
|
||||
uuid: string
|
||||
}>
|
||||
}[]
|
||||
}
|
||||
|
||||
const EvidenceList = ( {
|
||||
|
||||
@@ -20,18 +20,18 @@ import AddEvidenceSheet from "./Sheets/AddEvidenceSheet";
|
||||
type Props = {
|
||||
currentObservation: Object,
|
||||
isFetchingLocation: boolean,
|
||||
locationTextClassNames: Array<string>,
|
||||
locationTextClassNames: string[],
|
||||
passesEvidenceTest: Function,
|
||||
observationPhotos: Array<Object>,
|
||||
observationPhotos: Object[],
|
||||
setShowAddEvidenceSheet: Function,
|
||||
showAddEvidenceSheet: boolean,
|
||||
observationSounds?: Array<{
|
||||
observationSounds?: {
|
||||
id?: number,
|
||||
sound: {
|
||||
file_url: string,
|
||||
},
|
||||
uuid: string
|
||||
}>,
|
||||
}[],
|
||||
onLocationPress: ( ) => void,
|
||||
updateObservationKeys: Function
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { useTranslation } from "sharedHooks";
|
||||
type Props = {
|
||||
currentObservationIndex: number,
|
||||
setCurrentObservationIndex: Function,
|
||||
observations: Array<Object>,
|
||||
observations: Object[],
|
||||
setResetScreen: Function,
|
||||
transitionAnimation: Function,
|
||||
transitionAnimationRef: Object
|
||||
|
||||
@@ -21,7 +21,7 @@ import DiscardObservationSheet from "./Sheets/DiscardObservationSheet";
|
||||
const { useRealm } = RealmContext;
|
||||
|
||||
type Props = {
|
||||
observations: Array<Object>,
|
||||
observations: Object[],
|
||||
currentObservation: Object
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ const { useRealm } = RealmContext;
|
||||
type Props = {
|
||||
currentObservation: Object,
|
||||
onPressClose: Function,
|
||||
observations: Array<Object>,
|
||||
observations: Object[],
|
||||
onDelete?: Function,
|
||||
updateObservations: Function
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ const { useRealm } = RealmContext;
|
||||
type Props = {
|
||||
onPressClose: Function,
|
||||
discardObservation: Function,
|
||||
observations: Array<Object>,
|
||||
observations: Object[],
|
||||
onSave?: Function
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ const AnimatedFlashList = Animated.createAnimatedComponent( CustomFlashList );
|
||||
|
||||
type Props = {
|
||||
contentContainerStyle?: Object,
|
||||
data: Array<Object>,
|
||||
data: Object[],
|
||||
dataCanBeFetched?: boolean,
|
||||
fetchFromLastObservation?: Function,
|
||||
explore: boolean,
|
||||
|
||||
@@ -7,7 +7,7 @@ import React from "react";
|
||||
|
||||
type Props = {
|
||||
item: Object,
|
||||
selectedObservations: Array<Object>,
|
||||
selectedObservations: Object[],
|
||||
selectObservationPhotos: Function,
|
||||
style?: Object
|
||||
}
|
||||
|
||||
@@ -23,11 +23,11 @@ import GroupPhotoImage from "./GroupPhotoImage";
|
||||
|
||||
type Props = {
|
||||
combinePhotos: Function,
|
||||
groupedPhotos: Array<Object>,
|
||||
groupedPhotos: Object[],
|
||||
isCreatingObservations?: boolean,
|
||||
navBasedOnUserSettings: Function,
|
||||
removePhotos: Function,
|
||||
selectedObservations: Array<Object>,
|
||||
selectedObservations: Object[],
|
||||
selectObservationPhotos: Function,
|
||||
separatePhotos: Function,
|
||||
totalPhotos: number
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
const sortByTime = array => array.sort( ( a, b ) => b.timestamp - a.timestamp );
|
||||
|
||||
const flattenAndOrderSelectedPhotos = ( selectedObservations: ?Array<Object> ): Array<Object> => {
|
||||
const flattenAndOrderSelectedPhotos = ( selectedObservations: ?Object[] ): Object[] => {
|
||||
// combine selected observations into a single array
|
||||
let combinedPhotos = [];
|
||||
selectedObservations?.forEach( obs => {
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
import ProjectListItem from "./ProjectListItem";
|
||||
|
||||
interface Props {
|
||||
projects: Array<object>;
|
||||
projects: object[];
|
||||
ListEmptyComponent?: React.JSX.Element;
|
||||
ListFooterComponent?: React.JSX.Element;
|
||||
onEndReached?: ( ) => void;
|
||||
|
||||
@@ -12,10 +12,10 @@ import changeLanguage from "sharedHelpers/changeLanguage";
|
||||
import { useTranslation } from "sharedHooks";
|
||||
import { zustandStorage } from "stores/useStore";
|
||||
|
||||
type LocalesResponse = Array<{
|
||||
type LocalesResponse = {
|
||||
locale: string;
|
||||
language_in_locale: string;
|
||||
}>;
|
||||
}[];
|
||||
|
||||
type Props = {
|
||||
onChange: ( newLocale: string ) => void;
|
||||
|
||||
@@ -23,7 +23,7 @@ interface Props extends PropsWithChildren {
|
||||
containerClass?: string;
|
||||
onLayout?: () => void;
|
||||
sticky?: boolean;
|
||||
buttonConfiguration?: Array<ButtonConfiguration>;
|
||||
buttonConfiguration?: ButtonConfiguration[];
|
||||
}
|
||||
|
||||
// Ensure this component is placed outside of scroll views
|
||||
|
||||
@@ -36,7 +36,7 @@ interface Props {
|
||||
// Callback when the user presses the close button or backdrop, not whenever the sheet
|
||||
// closes
|
||||
onPressClose?: ( ) => void;
|
||||
snapPoints?: Array<string>;
|
||||
snapPoints?: string[];
|
||||
insideModal?: boolean;
|
||||
keyboardShouldPersistTaps?: string;
|
||||
testID?: string;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { View } from "components/styledComponents";
|
||||
import React from "react";
|
||||
|
||||
type Props = {
|
||||
iconClasses: Array<string>;
|
||||
iconClasses: string[];
|
||||
completeColor: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { useTranslation } from "sharedHooks";
|
||||
type Props = {
|
||||
color: string;
|
||||
progress: number;
|
||||
iconClasses: Array<string>;
|
||||
iconClasses: string[];
|
||||
uniqueKey?: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ type Props = {
|
||||
shouldUseEvidenceLocation: boolean,
|
||||
onPressPhoto: Function,
|
||||
onTaxonChosen: Function,
|
||||
photoUris: Array<string>,
|
||||
photoUris: string[],
|
||||
reloadSuggestions: Function,
|
||||
selectedPhotoUri: string,
|
||||
showImproveWithLocationButton: boolean,
|
||||
|
||||
@@ -40,7 +40,7 @@ type Props = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
hideLocationToggleButton: Function;
|
||||
hideSkip?: boolean;
|
||||
observers: Array<string>;
|
||||
observers: string[];
|
||||
shouldUseEvidenceLocation: boolean;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
toggleLocation: Function;
|
||||
|
||||
@@ -13,7 +13,7 @@ const params = {
|
||||
},
|
||||
};
|
||||
|
||||
const useObservers = ( taxonIds: Array<number> ): Array<string> => {
|
||||
const useObservers = ( taxonIds: number[] ): string[] => {
|
||||
const { data } = useAuthenticatedQuery(
|
||||
["fetchObservers", taxonIds],
|
||||
( ) => fetchObservers( {
|
||||
|
||||
@@ -20,13 +20,13 @@ import Photo from "realmModels/Photo";
|
||||
type Props = {
|
||||
loading: boolean,
|
||||
onChangeIndex?: Function,
|
||||
photos: Array<{
|
||||
photos: {
|
||||
id?: number,
|
||||
url: string,
|
||||
localFilePath?: string,
|
||||
attribution?: string,
|
||||
licenseCode?: string
|
||||
}>,
|
||||
}[],
|
||||
tablet: boolean
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ interface Props {
|
||||
ListFooterComponent?: React.JSX.Element;
|
||||
onEndReached?: ( ) => void;
|
||||
refreshing?: boolean;
|
||||
users: Array<object>;
|
||||
users: object[];
|
||||
onPress?: ( ) => void;
|
||||
accessibilityLabel?: string;
|
||||
keyboardShouldPersistTaps?: string;
|
||||
|
||||
@@ -16,7 +16,7 @@ const DROP_SHADOW = getShadow( {
|
||||
} );
|
||||
|
||||
type Props = {
|
||||
tabs: Array<Object>,
|
||||
tabs: Object[],
|
||||
};
|
||||
|
||||
/* eslint-disable react/jsx-props-no-spreading */
|
||||
|
||||
@@ -161,10 +161,10 @@ interface PLACE {
|
||||
id: number;
|
||||
place_type: number;
|
||||
point_geojson: {
|
||||
coordinates: Array<number>;
|
||||
coordinates: number[];
|
||||
};
|
||||
bounding_box_geojson?: {
|
||||
coordinates: Array<number>;
|
||||
coordinates: number[];
|
||||
};
|
||||
type: string;
|
||||
}
|
||||
|
||||
12
src/realmModels/types.d.ts
vendored
12
src/realmModels/types.d.ts
vendored
@@ -106,18 +106,18 @@ export interface RealmObservationPojo {
|
||||
_created_at?: Date;
|
||||
_synced_at?: Date;
|
||||
captive_flag: boolean | null;
|
||||
comments: Array<RealmComment>;
|
||||
comments: RealmComment[];
|
||||
comments_viewed?: boolean;
|
||||
description: string | null;
|
||||
geoprivacy: string | null;
|
||||
identifications: Array<RealmIdentification>;
|
||||
identifications: RealmIdentification[];
|
||||
identifications_viewed?: boolean;
|
||||
latitude: number | null;
|
||||
license_code: License | null;
|
||||
longitude: number | null;
|
||||
obscured?: boolean;
|
||||
observationPhotos: Array<RealmObservationPhotoPojo>;
|
||||
observationSounds: Array<RealmObservationSoundPojo>;
|
||||
observationPhotos: RealmObservationPhotoPojo[];
|
||||
observationSounds: RealmObservationSoundPojo[];
|
||||
observed_on?: string;
|
||||
observed_on_string: string | null;
|
||||
observed_time_zone?: string;
|
||||
@@ -139,8 +139,8 @@ export interface RealmObservationPojo {
|
||||
export interface RealmObservation extends RealmObservationPojo {
|
||||
missingBasics: ( ) => boolean;
|
||||
needsSync: ( ) => boolean;
|
||||
observationPhotos: Array<RealmObservationPhoto>;
|
||||
observationSounds: Array<RealmObservationSound>;
|
||||
observationPhotos: RealmObservationPhoto[];
|
||||
observationSounds: RealmObservationSound[];
|
||||
unviewed: ( ) => boolean;
|
||||
updateNeedsSync: ( ) => boolean;
|
||||
viewed: ( ) => boolean;
|
||||
|
||||
@@ -5,24 +5,24 @@ class FlashListPerformanceTracker {
|
||||
|
||||
private itemsVisibleDuration: number;
|
||||
|
||||
private scrollEvents: Array<{
|
||||
private scrollEvents: {
|
||||
startTime: number;
|
||||
endTime: number;
|
||||
duration: number;
|
||||
itemsFetched: number;
|
||||
scrollDistance: number;
|
||||
}> = [];
|
||||
}[] = [];
|
||||
|
||||
private currentScrollEvent: unknown = null;
|
||||
|
||||
private fetchStartTime: number;
|
||||
|
||||
private fetchEvents: Array<{
|
||||
private fetchEvents: {
|
||||
startTime: number;
|
||||
endTime: number;
|
||||
duration: number;
|
||||
itemsCount: number;
|
||||
}> = [];
|
||||
}[] = [];
|
||||
|
||||
private persistentMetrics = {
|
||||
lastFetchTime: null as number | null,
|
||||
|
||||
@@ -63,11 +63,11 @@ export const formatExifDateAsString = ( datetime: string ): string => {
|
||||
|
||||
// Parse the EXIF of all photos - fill out details (lat/lng/date) from all of these,
|
||||
// in case the first photo is missing EXIF
|
||||
export const readExifFromMultiplePhotos = async ( photoUris: Array<string> ): Promise<Object> => {
|
||||
export const readExifFromMultiplePhotos = async ( photoUris: string[] ): Promise<Object> => {
|
||||
const unifiedExif = {};
|
||||
|
||||
const responses = await Promise.allSettled( photoUris.map( parseExif ) );
|
||||
const allExifPhotos: Array<{
|
||||
const allExifPhotos: {
|
||||
latitude: number,
|
||||
longitude: number,
|
||||
positional_accuracy: number,
|
||||
@@ -75,7 +75,7 @@ export const readExifFromMultiplePhotos = async ( photoUris: Array<string> ): Pr
|
||||
// Flow will complain that value is undefined, but the filter call ensures
|
||||
// that it isn't
|
||||
// $FlowIgnore
|
||||
}> = responses.filter( r => r.value ).map( r => r.value );
|
||||
}[] = responses.filter( r => r.value ).map( r => r.value );
|
||||
|
||||
allExifPhotos.filter( x => x ).forEach(
|
||||
currentPhotoExif => {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { useCurrentUser } from "sharedHooks";
|
||||
// Should work like React Query's useInfiniteQuery with our custom reactQueryRetry
|
||||
// and authentication
|
||||
const useAuthenticatedInfiniteQuery = (
|
||||
queryKey: Array<string>,
|
||||
queryKey: string[],
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
queryFunction: Function,
|
||||
queryOptions: object = {},
|
||||
|
||||
@@ -5,7 +5,7 @@ const useInfiniteUserScroll = (
|
||||
queryKey: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
apiCall: Function,
|
||||
ids: Array<object>,
|
||||
ids: object[],
|
||||
newInputParams: object,
|
||||
options: {
|
||||
enabled: boolean;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { handleRetryDelay, reactQueryRetry } from "sharedHelpers/logging";
|
||||
|
||||
// Should work like React Query's useQuery with our custom reactQueryRetry
|
||||
const useNonAuthenticatedQuery = (
|
||||
queryKey: Array<string>,
|
||||
queryKey: string[],
|
||||
queryFunction: QueryFunction,
|
||||
queryOptions: object = {},
|
||||
) => useQuery( {
|
||||
|
||||
@@ -16,7 +16,7 @@ interface SyncObservationsSlice {
|
||||
autoSyncAbortController: AbortController | null;
|
||||
currentDeleteCount: number;
|
||||
deleteError: string | null;
|
||||
deleteQueue: Array<string>;
|
||||
deleteQueue: string[];
|
||||
deletionsCompletedAt: Date | null;
|
||||
initialNumDeletionsInQueue: number;
|
||||
syncingStatus: SyncingStatus;
|
||||
|
||||
@@ -30,8 +30,8 @@ interface UploadObservationsSlice {
|
||||
numUploadsAttempted: number;
|
||||
totalToolbarIncrements: number;
|
||||
totalToolbarProgress: number;
|
||||
totalUploadProgress: Array<TotalUploadProgress>;
|
||||
uploadQueue: Array<string>;
|
||||
totalUploadProgress: TotalUploadProgress[];
|
||||
uploadQueue: string[];
|
||||
uploadStatus: UploadStatus;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ interface MediaApiResponse {
|
||||
page: number;
|
||||
per_page: number;
|
||||
total_results: number;
|
||||
results: Array<{
|
||||
results: {
|
||||
id: number;
|
||||
}>;
|
||||
}[];
|
||||
}
|
||||
|
||||
interface MappedObservationPhotoForUpdating {
|
||||
|
||||
@@ -38,10 +38,10 @@ interface ObservationApiResponse {
|
||||
page: number;
|
||||
per_page: number;
|
||||
total_results: number;
|
||||
results: Array<{
|
||||
results: {
|
||||
uuid: string;
|
||||
id: number;
|
||||
}>;
|
||||
}[];
|
||||
}
|
||||
|
||||
async function validateAndGetToken( ): Promise<string> {
|
||||
|
||||
@@ -84,7 +84,7 @@ const markRecordUploaded = (
|
||||
recordUUID: string | null,
|
||||
type: string,
|
||||
response: {
|
||||
results: Array<{id: number}>;
|
||||
results: {id: number}[];
|
||||
},
|
||||
realm: object,
|
||||
options?: {
|
||||
|
||||
Reference in New Issue
Block a user