Skip to content

Upgrade to TypeScript 6#11268

Merged
nbudin merged 16 commits intomainfrom
upgrade-typescript-6
May 2, 2026
Merged

Upgrade to TypeScript 6#11268
nbudin merged 16 commits intomainfrom
upgrade-typescript-6

Conversation

@nbudin
Copy link
Copy Markdown
Contributor

@nbudin nbudin commented Apr 8, 2026

Summary

  • Upgrades the project to TypeScript 6 and fixes all resulting type errors
  • TypeScript 6 introduces stricter variance checking for generic type parameters, which surfaced a large number of type issues across the codebase

Key changes

  • React Select: Fix SingleValue/MultiValue component generic type constraints
  • TanStack Table: Fix ColumnDef variance and DateTime nullable comparator errors
  • FormAdmin: Fix property setter variance, form item editor types, and React Compiler dependency array
  • Permissions system: Add function overloads to PermissionsTableInput; cast useChangeSet add functions throughout
  • Form/Event components: Widen form_response_attrs callback parameter types to handle contravariance
  • Store/TicketTypeAdmin: Fix Dispatch<SetStateAction> variance; materialize functional updates in buildScheduledMoneyValueInput
  • GraphQL selects: Change TypedDocumentNode constraint to TypedDocumentNode<any, any> to handle TypeScript 6's proper variance checking of phantom type parameters
  • parsePageContent: Fix ProcessingInstruction<T> contravariance; fix reduce accumulator types
  • SignupAdmin route: Remove required prop from route component (must be ComponentType<{}>)
  • Various: Fix ProgressEvent type parameters, memo'd generic callback casts, reduce generics, flatMap with Set

Test plan

  • TypeScript compiles with zero errors (yarn run tsc --noEmit)
  • ESLint passes on all changed files
  • Manual smoke test of key areas: form editor, store/products, permissions admin, signup admin

🤖 Generated with Claude Code

@nbudin nbudin added enhancement minor Bumps the minor version number on release labels Apr 8, 2026
@nbudin nbudin force-pushed the upgrade-typescript-6 branch from 2aed159 to 248ce09 Compare April 8, 2026 19:09
Comment thread app/javascript/RootSiteAdmin/EditRootSite.tsx Outdated
Comment thread app/javascript/Store/OrderPaymentModal.tsx Outdated
Comment thread app/javascript/Store/ProductAdmin/EditProductForm.tsx Outdated
Comment thread app/javascript/Store/ProductAdmin/PricingStructureInput.tsx Outdated
Comment thread app/javascript/TicketTypeAdmin/EditTicketProvidingProductModal.tsx Outdated
Comment thread app/javascript/TicketTypeAdmin/EditTicketType.tsx Outdated
Comment thread app/javascript/Authentication/EditUser.tsx Outdated
Comment thread app/javascript/ConventionAdmin/ConventionFormGeneralSection.tsx
Comment thread app/javascript/packs/application.tsx Outdated
Comment thread app/javascript/RootSiteConventionsAdmin/NewConventionModal.tsx Outdated
Comment thread app/javascript/UIComponents/ScheduledValuePreview.tsx
Comment thread app/javascript/UserActivityAlerts/EditUserActivityAlert.tsx Outdated
Comment thread app/javascript/UserActivityAlerts/NewUserActivityAlert.tsx Outdated
Comment thread app/javascript/AuthenticityTokensContext.tsx Outdated
Comment thread app/javascript/BuiltInFormControls/GraphQLAsyncSelect.tsx Outdated
Comment thread app/javascript/BuiltInFormControls/UserConProfileSelect.tsx Outdated
Comment thread app/javascript/DevModeGraphiql.tsx
Comment thread app/javascript/parsePageContent.tsx Outdated
nbudin and others added 8 commits May 2, 2026 10:32
Handle null from SingleValue<T> (isClearable selects) and readonly
from MultiValue<T> across all affected components. For non-nullable
GraphQL fields (defaultLayout, rootPage), guard against null with
short-circuit evaluation since the API would reject null values anyway.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
TypeScript now types catch clause variables as unknown. Fix by using
instanceof guards, as-casts where the throw source guarantees Error
objects (Apollo mutations), and widening parseResponseErrors to accept
unknown instead of Error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…r errors

ColumnDef<TData, TValue> has invariant TValue in TypeScript 6, so mixed arrays
must be typed as ColumnDef<T, any>[]. Also fix Timespan comparators to accept
nullable DateTime values.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add ambient module declaration for vite/modulepreload-polyfill (TS2882)
- Fix ColumnReservationSet properties initialized via clear() method (TS2564)
- Fix ScheduledValueTimespanRow valueChanged callback to accept undefined (TS2345)
- Fix setupI18Next formatter lng param to accept undefined (TS2345)
- Fix useAsyncFetcher resolve cast to match ref type (TS2322)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Use `as` casts with `typeof formItem` switch narrowing to handle
stricter Dispatch<SetStateAction<T>> variance in TypeScript 6.
Update formItemPropertyUpdater to accept Dispatch<SetStateAction<T>>.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add function overloads to PermissionsTableInput to fix JSX component usage
- Cast `add` function from useChangeSet to UsePermissionsChangeSetOptions type
  in CmsContentGroupFormFields, EditCmsContentGroup, NewCmsContentGroup,
  EditStaffPositionPermissions, and useOrganizationRoleForm

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Cast ObjectDiffDisplay before/after props in FormItemChangeDisplay
- Fix isValueOther type predicate in MultipleChoiceItemDisplay
- Fix run and onChange types in EditRunModal
- Widen newResponseValues parameter types in useEventForm,
  EventProposalForm, UserConProfileForm, and MyProfileForm

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
nbudin and others added 7 commits May 2, 2026 10:32
- Fix buildScheduledMoneyValueInput to materialize functional updates
  instead of forwarding SetStateAction (fixes PricingStructureForm)
- Fix EditPricingStructureModal local type to use NonNullable to avoid
  null in useState type, removing redundant cast
- Use PricingStructureFormProps/PricingStructureModalState as cast targets
  in EditProductForm and PricingStructureInput
- Fix AdminProductVariantsTable onChange type to accept SetStateAction
- Fix AdminOrderEntriesTable ProductSelect onChange cast
- Fix CouponForm MoneyInput onChange to handle functional updates
- Cast setProduct and setTicketType in EditTicketProvidingProductModal
  and EditTicketType

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix AuthenticityTokensContext key indexing
- Fix FileUploadForm ProgressEvent type parameter
- Cast memo'd generic callbacks in ScheduledValuePreview
- Cast DataModeApplicationEntry as ComponentType<unknown> in application.tsx
- Fix UserActivityAlerts notification destination cast types
- Cast setLanguage in ConventionFormGeneralSection and NewConventionModal
- Cast onChange in EventListFilterableFormItemDropdown
- Fix StaffPositionsTable reduce type to use generic parameter
- Spread Set to array in ReactTableExportButtonWithColumnTransform
- Cast setFormState in EditUser

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Change GraphQLAsyncSelect/UserConProfileSelectProps constraint to
  TypedDocumentNode<any, any> to handle TypeScript 6 variance checking
  of phantom type parameters (needed to bypass the contravariant
  TVariables check that bare TypedDocumentNode introduces)
- Cast DevModeGraphiql fetcher to resolve Observable type mismatch
- Fix parsePageContent reduce accumulator type to include CSSProperties,
  cast processNode callbacks and AUTHENTICATION_LINK_PROCESSING_INSTRUCTIONS
  to avoid contravariant ProcessingInstruction<T> errors

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove required teamMembersUrl prop from EditSignup and derive the URL
internally from useParams, allowing the component to be used as a
route Component (which requires ComponentType<{}>)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add explicit ColumnDef<RowType, any>[] return type annotations to useMemo
calls in table components so TypeScript 6 no longer tries to infer a union
of AccessorKeyColumnDef types and fails strict variance checking. Also fix
a missing useMemo dependency in RunSignupChangesTable and an optional
chaining inconsistency in SignupModerationQueue.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nbudin nbudin force-pushed the upgrade-typescript-6 branch from 3d3a009 to 5736656 Compare May 2, 2026 17:32
@nbudin nbudin marked this pull request as ready for review May 2, 2026 17:33
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

Code Coverage Report: Only Changed Files listed

Package Base Coverage New Coverage Difference
app/javascript/AuthenticityTokensContext.tsx 🔴 25% 🔴 23.81% 🔴 -1.19%
app/javascript/BuiltInFormControls/AddFileModal.tsx 🔴 0% 🔴 33.33% 🟢 33.33%
app/javascript/BuiltInFormControls/LiquidInput.tsx 🟠 57.5% 🟠 60% 🟢 2.5%
app/javascript/TimeUtils.ts 🟠 56.86% 🟠 58.49% 🟢 1.63%
Overall Coverage 🟢 53.08% 🟢 53.1% 🟢 0.02%

Minimum allowed coverage is 0%, this run produced 53.1%

@nbudin nbudin merged commit b299c1d into main May 2, 2026
18 checks passed
@nbudin nbudin deleted the upgrade-typescript-6 branch May 2, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement minor Bumps the minor version number on release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant