Skip to content

Commit

Permalink
fix a couple any types (#3464)
Browse files Browse the repository at this point in the history
* fix a couple things

* fix

* a few more things

* Update website/src/utils/search.ts

Co-authored-by: Fabian Engelniederhammer <[email protected]>

* use details type

* revert DocsMenu change

---------

Co-authored-by: Fabian Engelniederhammer <[email protected]>
  • Loading branch information
fhennig and fengelniederhammer authored Dec 18, 2024
1 parent 1192aa0 commit 1bad30c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions website/src/components/DataUseTerms/EditDataUseTermsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
type DataUseTerms,
type DataUseTermsOption,
} from '../../types/backend';
import type { Details } from '../../types/lapis';
import type { ClientConfig } from '../../types/runtimeConfig';
import { createAuthorizationHeader } from '../../utils/createAuthorizationHeader';
import type { SequenceFilter } from '../SearchPage/DownloadDialog/SequenceFilters';
Expand All @@ -31,7 +32,7 @@ type LoadingState = {

type ErrorState = {
type: 'error';
error: unknown; // not too happy about the 'any' here, but I think it's fine
error: unknown;
};

type ResultType = 'allOpen' | 'mixed' | 'allRestricted';
Expand All @@ -47,8 +48,7 @@ type LoadedState = {
earliestRestrictedUntil: DateTime | null;
};

// eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO(#3451) use proper types
function getLoadedState(rows: Record<string, any>[]): LoadedState {
function getLoadedState(rows: Details[]): LoadedState {
const openAccessions: string[] = [];
const restrictedAccessions = new Map<string, string>();
let earliestRestrictedUntil: DateTime | null = null;
Expand Down
10 changes: 5 additions & 5 deletions website/src/utils/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { sentenceCase } from 'change-case';
import { type BaseType } from './sequenceTypeHelpers';
import type { TableSequenceData } from '../components/SearchPage/Table';
import { getReferenceGenomes } from '../config';
import type { GroupedMetadataFilter, Metadata, MetadataFilter, Schema } from '../types/config';
import type { FieldValues, GroupedMetadataFilter, Metadata, MetadataFilter, Schema } from '../types/config';
import type { ReferenceGenomesSequenceNames, ReferenceAccession, NamedSequence } from '../types/referencesGenomes';

export const VISIBILITY_PREFIX = 'visibility_';
Expand Down Expand Up @@ -187,13 +187,12 @@ export const consolidateGroupedFields = (filters: MetadataFilter[]): Consolidate
return fieldList;
};

/* eslint-disable @typescript-eslint/no-explicit-any -- TODO(#3451) use proper types */
export const getFieldValuesFromQuery = (
state: Record<string, string>,
hiddenFieldValues: Record<string, any>,
hiddenFieldValues: FieldValues,
schema: Schema,
): Record<string, any> => {
const values: Record<string, any> = { ...hiddenFieldValues };
): FieldValues => {
const values: FieldValues = { ...hiddenFieldValues };
const expandedSchema = getMetadataSchemaWithExpandedRanges(schema.metadata);
for (const field of expandedSchema) {
if (field.name in state) {
Expand Down Expand Up @@ -229,6 +228,7 @@ const makeCaseInsensitiveLiteralSubstringRegex = (s: string): string => {
return `(?i)${s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`;
};

/* eslint-disable @typescript-eslint/no-explicit-any -- TODO(#3451) use proper types */
export const getLapisSearchParameters = (
fieldValues: Record<string, any>,
referenceGenomesSequenceNames: ReferenceGenomesSequenceNames,
Expand Down
4 changes: 2 additions & 2 deletions website/src/utils/serversideSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import {
import type { TableSequenceData } from '../components/SearchPage/Table';
import { LapisClient } from '../services/lapisClient';
import { pageSize } from '../settings';
import type { Schema } from '../types/config';
import type { FieldValues, Schema } from '../types/config';
import type { ReferenceGenomesSequenceNames } from '../types/referencesGenomes';

export const performLapisSearchQueries = async (
state: Record<string, string>,
schema: Schema,
referenceGenomesSequenceNames: ReferenceGenomesSequenceNames,
hiddenFieldValues: Record<string, any>, // eslint-disable-line @typescript-eslint/no-explicit-any -- TODO(#3451) use `unknown`or proper types
hiddenFieldValues: FieldValues,
organism: string,
): Promise<SearchResponse> => {
const fieldValues = getFieldValuesFromQuery(state, hiddenFieldValues, schema);
Expand Down

0 comments on commit 1bad30c

Please sign in to comment.