Skip to content

Claude/convert web-common to typescript [Claude Code Web]#1548

Closed
bobular wants to merge 9 commits into
claude/convert-javascript-to-typescript-012z2Uvk7b9qS22i3cpy88bPfrom
claude/convert-web-common-to-typescript-01GbVeHfx5bGBQL1RnPbsbGd
Closed

Claude/convert web-common to typescript [Claude Code Web]#1548
bobular wants to merge 9 commits into
claude/convert-javascript-to-typescript-012z2Uvk7b9qS22i3cpy88bPfrom
claude/convert-web-common-to-typescript-01GbVeHfx5bGBQL1RnPbsbGd

Conversation

@bobular
Copy link
Copy Markdown
Member

@bobular bobular commented Nov 15, 2025

Note that the base is not main

- Convert 10 utility files from .js/.jsx to .ts/.tsx
- Replace PropTypes with TypeScript interfaces
- Add type annotations to all functions
- Import existing WDK types where available (CategoryTreeNode, etc.)
- Use generic types for localStorage persistence functions

Files converted:
- util/classNames.ts
- util/formatters.ts
- util/domUtils.ts
- util/http.ts
- util/persistence.ts
- util/reporter.ts
- util/paramUtil.ts
- util/category.ts
- util/homeContent.tsx (JSX for React components)
- util/modelSpecificUtil.ts
- Convert wrapWdkService.js to .ts with type annotations
- Convert wrapStoreModules.ts with Redux reducer types
- Convert publicPath.ts with webpack global declarations
- Add proper type annotations for WDK service wrappers
- Add type annotations for Redux state and actions

Files converted:
- wrapWdkService.ts
- wrapStoreModules.ts
- publicPath.ts
Converted 19 JavaScript files to TypeScript with proper type annotations:

Store Modules (3 files):
- store-modules/GalaxyTerms.ts
- store-modules/ContactUsStoreModule.ts
- selectors/ContactUsSelectors.ts

Action Creators (4 files):
- actioncreators/GlobalActionCreators.ts
- actioncreators/QuestionWizardActionCreators.ts
- actioncreators/ContactUsActionCreators.ts
- actioncreators/GalaxyTermsActionCreators.ts

App Reducers and Utils (8 files):
- App/Searches/SearchCardReducer.ts
- App/Searches/SearchCardActionCreators.ts
- App/Searches/SearchUtils.ts
- App/Studies/StudyReducer.ts
- App/Studies/StudyActionCreators.ts
- App/NewsSidebar/NewsModule.ts
- App/Utils/Utils.ts
- App/Categories/CategoryUtils.tsx

Key improvements:
- Added Redux state and action type interfaces
- Defined discriminated union types for actions
- Imported WDK model types (Question, RecordClass, etc.)
- Added RxJS epic type annotations
- Removed PropTypes in favor of TypeScript interfaces
Converted all 16 remaining JavaScript files to TypeScript:

Index files (14 simple re-exports):
- controllers/index.ts
- App/Hero/index.ts
- App/Showcase/index.ts
- App/UserMenu/index.ts
- App/Searches/index.ts
- App/Home/index.ts
- App/NewsSidebar/index.ts
- App/ImageCard/index.ts
- App/Header/index.ts
- App/Categories/index.ts
- App/Modal/index.ts
- App/SiteMenu/index.ts
- App/Studies/index.ts
- components/index.ts

Utility files with type annotations (2 files):
- component-wrappers/index.ts (added React.ComponentType return type)
- component-wrappers/util.ts (added WebpackContext type, typed findExportWith)

All .js files in web-common are now converted to TypeScript!
…ipt (24 files)

Controllers (7 files):
- GalaxyTermsController.tsx - Added Redux state/dispatch props
- ContactUsController.tsx - Complex form with file handling types
- CardBasedIndexController.tsx - Custom HOC pattern
- TreeDataViewerController.tsx - Tree state management
- HeaderController.tsx - Simple ViewController
- QuestionWizardController.tsx - Complex wizard with discriminated unions
- FooterController.tsx - Simple ViewController

Utilities (3 files):
- util/menuItems.tsx - Menu item generation with WDK types
- util/customElements.tsx - Custom element registration
- util/component.tsx - HOC decorators, removed PropTypes

Core files (2 files):
- routes.tsx - Route configuration with RouteEntry types
- scroll-to-top.tsx - Scroll-to-top button component

App Components (12 files):
- Hero/Hero.tsx
- Showcase/Showcase.tsx, ShowcaseFilter.tsx, CardList.tsx, PlaceholderCard.tsx
- Searches/SearchCard.tsx
- Home/Home.tsx
- NewsSidebar/News.tsx
- ImageCard/ImageCard.tsx
- Header/Header.tsx, HeaderNav.tsx
- Modal/Modal.tsx

Key improvements:
- Added comprehensive prop and state interfaces
- Removed PropTypes in favor of TypeScript
- Used existing WDK types (Question, RecordClass, User, etc.)
- Properly typed Redux connect HOCs
- Added discriminated unions for complex state (QuestionWizard)
- Typed all event handlers and lifecycle methods
…omponents to TypeScript (30 files)

Component Wrappers (8 files):
- StudyRecordHeading.tsx - Redux connected study record wrapper
- DownloadForm.tsx - Download form wrapper with RecordClass types
- RecordPage.tsx - Dynamic record page components
- Footer.tsx, Header.tsx - Simple component wrappers
- StudyAnswerController.tsx - Study answer table with AttributeValue types
- UserMessageController.tsx - User message HOC pattern
- UserDatasetItemController.tsx - User dataset HOC with Question types

Studies/Categories/SiteMenu (8 files):
- App/Categories/CategoryIcon.tsx
- App/SiteMenu/SiteMenu.tsx, SiteMenuItem.tsx
- App/Studies/DownloadLink.tsx, StudySearches.tsx, StudyFilterUtils.tsx
- App/Studies/StudyCard.tsx, StudyMenuItem.tsx

Main Components (14 files):
- TwitterTimeline.tsx - Twitter widget integration
- GalaxyTerms.tsx - Galaxy security terms, removed PropTypes
- CardBasedIndex.tsx - Card index wrapper, removed PropTypes
- ApiApplicationSpecificProperties.tsx - Complex email preferences
- SrtHelp.tsx - Help component
- ValidatedSelect.tsx, ValidatedButton.tsx, ValidatedInput.tsx - Form validation
- SiteHeader.tsx - Site header wrapper
- SubscriptionManagementBanner.tsx - Email subscription banner
- Menu.tsx - Menu and MenuItem components, removed PropTypes
- QuickSearch.tsx - Quick search with routing, removed PropTypes
- validatedInputFieldFactory.tsx - HOC factory with generics
- CookieBanner.tsx - Cookie consent banner

Key improvements:
- Removed PropTypes from 5 components (GalaxyTerms, CardBasedIndex, Menu, QuickSearch, and inferred from others)
- Added comprehensive prop and state interfaces
- Used WDK model types (RecordInstance, RecordClass, Question, User, etc.)
- Proper HOC generic type constraints
- Added React.CSSProperties for inline styles
- Typed all event handlers and callbacks
Reporter Forms - Batch 1 (10 files):
- SequenceFormElements.tsx, BedGeneReporterForm.tsx
- BedAndSequenceGenomicSequenceReporterForms.tsx
- ExcelNote.tsx, TranscriptAttributesReporterForm.tsx
- TabularReporterFormSubmitButtons.tsx, JsonReporterForm.tsx
- FastaOrthoSequenceReporterForm.tsx
- TableReporterForm.tsx, TranscriptTableReporterForm.tsx

Reporter Forms - Batch 2 (11 files):
- SequenceGeneReporterForm.tsx, SharedReporterForm.tsx
- Gff3ReporterForm.tsx, TextReporterForm.tsx, XmlReporterForm.tsx
- FastaGeneReporterForm.tsx, BedAndSequenceSimpleReporterForms.tsx
- SequenceFormFactory.tsx (complex factory with generics)
- ZippedFilesReporterForm.tsx
- FastaGenomicSequenceReporterForm.tsx, TabularReporterForm.tsx

ContactUs Components (11 files):
- ContactUsFinished.tsx, ContactUsSubmittedBody.tsx
- ContactUsPreamble.tsx, ContactUsAttachments.tsx
- ContactUsFooter.tsx, ContactUsForm.tsx (25+ typed props)
- ContactUsInstructions.tsx, ContactUsSubmissionHeader.tsx
- ContactUsFinishedHeader.tsx, ContactUsSubmission.tsx
- ContactUsError.tsx

SupportForm Components (3 files):
- SupportFormBody.tsx, SupportFormField.tsx, SupportFormBase.tsx

Miscellaneous Components (10 files):
- ExternalResource.tsx, FilterFinder.tsx
- GalaxySignUp.tsx (removed PropTypes)
- GalaxyPageLayout.tsx, NewWindowLink.tsx
- SmallMenu.tsx (removed PropTypes, exported SmallMenuItem type)
- Footer.tsx, ClassicSiteHeader.tsx (removed PropTypes)
- ValidatedTextArea.tsx
- records/DatasetRecordClasses.DatasetRecordClass.tsx (most complex)

Key improvements:
- Removed PropTypes from GalaxySignUp, SmallMenu, ClassicSiteHeader, FilterFinder
- Added comprehensive prop/state interfaces for all 45 components
- Used WDK model types throughout (RecordClass, Question, AttributeValue, etc.)
- Typed all form event handlers with React.ChangeEvent
- Added generic type parameters in SequenceFormFactory
- Exported reusable types (SmallMenuItem, ValidatedAttachmentMetadata)

ALL JavaScript files in @veupathdb/web-common are now TypeScript!
Total converted: 147 files (.js + .jsx → .ts + .tsx)
@bobular bobular closed this Nov 19, 2025
@bobular bobular deleted the claude/convert-web-common-to-typescript-01GbVeHfx5bGBQL1RnPbsbGd branch November 19, 2025 21:54
@bobular bobular restored the claude/convert-web-common-to-typescript-01GbVeHfx5bGBQL1RnPbsbGd branch November 19, 2025 21:55
@bobular
Copy link
Copy Markdown
Member Author

bobular commented Nov 19, 2025

By closing/deleting this branch we are ignoring a bunch of edits made in web-common but first we need to get coreui and wdk-client sorted. It's probably better to redo the web-common conversion once those are done via #1550

@bobular bobular deleted the claude/convert-web-common-to-typescript-01GbVeHfx5bGBQL1RnPbsbGd branch November 19, 2025 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants