Chore: Centralize type definitions and lift search form logic#299
Merged
Chore: Centralize type definitions and lift search form logic#299
Conversation
Replace the named `type BaseCardProps = {...}` declaration with an
anonymous inline annotation on the component signature, in line with the
project rule that .tsx files should not host named type declarations.
Drop the named `Props` and `CheckboxRef` aliases in favor of placing the
ref element type and the `Omit<CheckboxProps, "ref"> & { label? }` shape
directly into the `React.forwardRef` generics, removing dead exports
that were not consumed elsewhere.
Remove the `export type Props = IconButtonProps` re-export, which was a no-op alias not imported elsewhere, and reference `IconButtonProps` directly in the `React.forwardRef` generic instead.
Drop the exported `Option<T>` and `Props<T>` declarations and write the generic option/props shape directly on the function signature. The exported aliases had no external consumers, so removing them keeps the component self-contained.
Remove the named `Props` declaration and place the
`Omit<MUITextFieldProps, "multiline"> & { minRows?, maxRows? }` shape
directly into the `React.forwardRef` generic so the type stays scoped
to the component.
Remove the `export type Props = MUITextFieldProps` alias, which served only as a renamed re-export with no external consumers, and reference `MUITextFieldProps` directly in the `React.forwardRef` generic.
CriteriaTags was importing CriteriaCode from "../../domain/criteria", but that module only re-imports the type from "./types.ts" without re-exporting it, so the import resolved to nothing under the app tsconfig (TS2724). Pull the type directly from "../../domain/types.ts" where it is actually declared.
Replace the named `type Props = {...}` declaration with an anonymous
inline annotation on the component signature, matching the rule that
.tsx view files should not host named type declarations.
Move SearchValues to domain/types.ts and consolidate Pagination, IdSortOption, and CriteriaCode usage so feature modules import a single source of truth. Remove the duplicate SearchHeritagesApiResponse file and the empty shared/api/http.ts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop named Props/HeritageCardProps/PaginationProps aliases and inline the prop shape on each component signature, matching the in-progress convention to keep .tsx files free of named type declarations. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ainer Move draft state, value sync, and submit handling out of TopPageContainer into SearchHeritageFormContainer so the top page only owns paging/order controls. Drop the onApiModeChange/redirect indirection that the new container makes unnecessary. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace the unchecked DetailResponse<T>/ListResponse<T> generic casts with isListResponse/isDetailResponse guards that throw on unexpected shapes, so malformed payloads fail loudly instead of leaking into the mappers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace single-letter parameter names (v/s/n/p/k) with descriptive ones (value/trimmed/parsed/params/key) so parse and serialize helpers read without decoding shorthand. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Translate Japanese comments to English in breadcrumb and pagination hook helpers. - Widen region-count error state to unknown so non-Error rejections pass through unchanged. - Inline the hook State type in useWorldHeritageDetail and tighten the AbortError detection helper. - Drop the unused short_description_jp pass-through in the detail mapper and the unused breadcrumbMap export from shared/types/routes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Now that the search result container imports from domain/types, the ApiSearchResponse alias is only consumed inside searchHeritages, so remove the export to keep the surface narrow. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 tasks
2 tasks
This reverts commit 9c6d703.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Consolidate duplicate type definitions across the codebase into
domain/types.ts and lift heritage search form logic into a dedicated container.
Changes
Type Centralization
Pagination,SearchValuesintodomain/types.tsUiPaginationand replace withPaginationfrom domainApiSearchResponseexportCriteriaCodefromdomain/typesinCriteriaTagsComponent Refactoring
SearchHeritageFormContainerTopPageContainerCode Quality
ascasts withreadonly string[]widening