mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-23 14:08:56 -05:00
Use record utility type in a few places (#3290)
* Replace object syntax with Record utility * Replace interface with Record utility I did not know how to be DRY here.
This commit is contained in:
@@ -15,9 +15,7 @@ interface Props {
|
||||
isDarkModeEnabled?: boolean;
|
||||
}
|
||||
|
||||
type Aliases = {
|
||||
[key: string]: string;
|
||||
};
|
||||
type Aliases = Record<string, string>;
|
||||
// Most of these are names for these icons used in design mapped to more
|
||||
// consistent and deduped filenames. We might also put aliases of convenience
|
||||
// here, e.g. "speech" and "chat" might both map to "comments" if we find
|
||||
|
||||
@@ -81,10 +81,11 @@ export function getMapRegion( totalBounds: MapBoundaries ): Region {
|
||||
};
|
||||
}
|
||||
|
||||
interface Params {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
export async function fetchObservationUUID( currentZoom: number, latLng: LatLng, params: Params ) {
|
||||
export async function fetchObservationUUID(
|
||||
currentZoom: number,
|
||||
latLng: LatLng,
|
||||
params: Record<string, unknown>
|
||||
) {
|
||||
const UTFPosition = createUTFPosition( currentZoom, latLng.latitude, latLng.longitude );
|
||||
const {
|
||||
mTilePositionX,
|
||||
@@ -92,7 +93,7 @@ export async function fetchObservationUUID( currentZoom: number, latLng: LatLng,
|
||||
mPixelPositionX,
|
||||
mPixelPositionY
|
||||
} = UTFPosition;
|
||||
const tilesParams: Params = {
|
||||
const tilesParams: Record<string, unknown> = {
|
||||
...params,
|
||||
style: "geotilegrid"
|
||||
};
|
||||
|
||||
@@ -15,15 +15,13 @@ interface Props {
|
||||
headerText: string;
|
||||
insideModal?: boolean;
|
||||
onPressClose?: ( ) => void;
|
||||
radioValues: {
|
||||
[key: string]: {
|
||||
value: string;
|
||||
icon?: string;
|
||||
label: string;
|
||||
text?: string;
|
||||
buttonText?: string;
|
||||
};
|
||||
};
|
||||
radioValues: Record<string, {
|
||||
value: string;
|
||||
icon?: string;
|
||||
label: string;
|
||||
text?: string;
|
||||
buttonText?: string;
|
||||
}>;
|
||||
selectedValue?: string;
|
||||
testID?: string;
|
||||
topDescriptionText?: React.JSX.Element;
|
||||
|
||||
@@ -68,7 +68,7 @@ const ALLOWED_ATTRIBUTES_NAMES = (
|
||||
"href src width height alt cite title class name abbr value align target rel"
|
||||
).split( " " );
|
||||
|
||||
const ALLOWED_ATTRIBUTES: { [key: string]: string[] } = { a: ["href"] };
|
||||
const ALLOWED_ATTRIBUTES: Record<string, string[]> = { a: ["href"] };
|
||||
ALLOWED_TAGS.filter( tag => tag !== "a" )
|
||||
.forEach( tag => { ALLOWED_ATTRIBUTES[tag] = ALLOWED_ATTRIBUTES_NAMES; } );
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
interface UTFGrid {
|
||||
grid: string[];
|
||||
keys: string[];
|
||||
data?: { [key: string]: unknown };
|
||||
data?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
const EXPANSION_PIXELS = 16;
|
||||
|
||||
Reference in New Issue
Block a user