Skip to content

Commit 353788e

Browse files
satraclaude
andcommitted
fix: add TypeScript type parameters to PropertyTable useQuery calls
Fixes build error: Property 'element' does not exist on type '{}'. Each useQuery now has explicit generic type parameters for proper type inference on data access. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a1d4b42 commit 353788e

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

frontend/components/PropertyTable.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,36 +69,39 @@ function useResolveEntities(
6969
primaryType: "elements" | "values" | "schemas" | "valuesets" = "elements",
7070
): Map<string, ResolvedEntity> {
7171
// Query all types for each sha256 — Apollo cache deduplicates
72-
const elementResults = sha256List.map((sha) => {
72+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
73+
type QResult = { sha: string; data: any };
74+
75+
const elementResults: QResult[] = sha256List.map((sha) => {
7376
// eslint-disable-next-line react-hooks/rules-of-hooks
74-
const { data } = useQuery(GET_ELEMENT, {
77+
const { data } = useQuery<{ element: { sha256: string; dataType?: string; unit?: string; provenance: { source: string; name: string }[] } | null }>(GET_ELEMENT, {
7578
variables: { sha256: sha.slice(0, 12) },
7679
skip: !sha || sha.length < 12 || (primaryType !== "elements" && primaryType !== "schemas"),
7780
});
7881
return { sha, data };
7982
});
8083

81-
const schemaResults = sha256List.map((sha) => {
84+
const schemaResults: QResult[] = sha256List.map((sha) => {
8285
// eslint-disable-next-line react-hooks/rules-of-hooks
83-
const { data } = useQuery(GET_SCHEMA, {
86+
const { data } = useQuery<{ schema_: { sha256: string; description?: string; provenance: { source: string; name: string }[] } | null }>(GET_SCHEMA, {
8487
variables: { sha256: sha.slice(0, 12) },
8588
skip: !sha || sha.length < 12,
8689
});
8790
return { sha, data };
8891
});
8992

90-
const valueResults = sha256List.map((sha) => {
93+
const valueResults: QResult[] = sha256List.map((sha) => {
9194
// eslint-disable-next-line react-hooks/rules-of-hooks
92-
const { data } = useQuery(GET_VALUE, {
95+
const { data } = useQuery<{ value: { sha256: string; label?: string; valueType?: string; provenance: { source: string; name: string }[] } | null }>(GET_VALUE, {
9396
variables: { sha256: sha.slice(0, 12) },
9497
skip: !sha || sha.length < 12 || (primaryType !== "values" && primaryType !== "valuesets"),
9598
});
9699
return { sha, data };
97100
});
98101

99-
const valuesetResults = sha256List.map((sha) => {
102+
const valuesetResults: QResult[] = sha256List.map((sha) => {
100103
// eslint-disable-next-line react-hooks/rules-of-hooks
101-
const { data } = useQuery(GET_VALUESET, {
104+
const { data } = useQuery<{ valueset: { sha256: string; name?: string; provenance: { source: string; name: string }[] } | null }>(GET_VALUESET, {
102105
variables: { sha256: sha.slice(0, 12) },
103106
skip: !sha || sha.length < 12 || primaryType !== "valuesets",
104107
});

0 commit comments

Comments
 (0)