Conversation
…gs and strict DOM interfaces
…solve typescript errors in web-client
…t entry formatter and updated usages
There was a problem hiding this comment.
Pull request overview
This PR focuses on resolving strict-mode TypeScript compilation issues across the web client, shared, and web-api layers by tightening/adjusting types, adding explicit casts/assertions, and updating a few call signatures/configs.
Changes:
- Updated multiple React views/components and Cerebral computeds/actions to satisfy strict null checks and stricter typings.
- Refactored docket entry formatting typings (introducing
FormattedDocketEntryandFormattedCaseDetailDocketEntry) and updated related tests accordingly. - Adjusted several server/lambda handlers and shared utilities to align with library/type expectations, plus updated ESLint flat config React version detection.
Reviewed changes
Copilot reviewed 80 out of 80 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| web-client/src/views/StartCaseUpdated/IrsNoticeUploadForm.tsx | Type adjustments for FormGroup errorText and file input props |
| web-client/src/views/StartCaseInternal/StartCaseInternal.tsx | Replaced div role="form" with semantic <form> element |
| web-client/src/views/StartCaseInternal/ElectronicServiceCheckbox.tsx | Added explicit prop/deps typing for Cerebral connect |
| web-client/src/views/FileDocument/ObjectionsForm.tsx | Added explicit React.FC prop typing wrapper |
| web-client/src/views/FileDocument/NonstandardForm.tsx | Added optional showIndex prop typing and defaulting |
| web-client/src/views/FileDocument/InclusionsForm.tsx | Added explicit React.FC prop typing wrapper |
| web-client/src/views/CaseDetail/PartiesInformationContentHeader.tsx | Type tightening for connected props/sequences |
| web-client/src/ustc-ui/FocusLock/FocusLock.tsx | Added stricter DOM/ref typings and non-null assertions |
| web-client/src/presenter/computeds/sessionAssignmentHelper.ts | Added RawUser import/cast for “Other” option |
| web-client/src/presenter/computeds/scanBatchPreviewerHelper.ts | Non-null assertions for selected batch access |
| web-client/src/presenter/computeds/formattedDocketEntries.ts | Added/expanded formatted docket entry types and refactored formatting logic |
| web-client/src/presenter/computeds/formattedDocketEntries.test.ts | Updated tests to use new FormattedDocketEntry typing |
| web-client/src/presenter/computeds/formattedDocketEntries.getShowSealDocketRecordEntry.test.ts | Updated imports/typing for refactored helper signature |
| web-client/src/presenter/computeds/formattedDocketEntries.getShowEditDocketRecordEntry.test.ts | Updated tests to match refactored helper signature and typings |
| web-client/src/presenter/computeds/formattedDocketEntries.getFormattedDocketEntry.test.ts | Updated tests with explicit Get typing and new return typing expectations |
| web-client/src/presenter/computeds/documentSigningHelper.ts | Non-null assertion for pdfjs object access |
| web-client/src/presenter/computeds/docketEntryQcHelper.ts | Cast current document into expected raw docket entry type |
| web-client/src/presenter/computeds/correspondenceViewerHelper.ts | Non-null assertion for viewer correspondence state |
| web-client/src/presenter/computeds/Public/publicCaseDetailHelper.test.ts | Cast formatted docket entry input to RawDocketEntry for strict typing |
| web-client/src/presenter/actions/unsetNegativeValueConfirmationTextAction.ts | Non-null assertion for confirmationText state indexing |
| web-client/src/presenter/actions/unsetNegativeValueConfirmationTextAction.test.ts | Updated test to align with non-null assertion |
| web-client/src/presenter/actions/setUserAction.test.ts | Updated global window delete to satisfy TS delete constraints |
| web-client/src/presenter/actions/setNegativeValueConfirmationTextAction.ts | Non-null assertion for confirmationText state indexing |
| web-client/src/presenter/actions/setNegativeValueConfirmationTextAction.test.ts | Updated test to align with non-null assertion |
| web-client/src/presenter/actions/saveAndSubmitCaseAction.ts | Cast petition metadata to expected case type |
| web-client/src/presenter/actions/openPractitionerDocumentDownloadUrlAction.ts | Typed caught error as any to access .message |
| web-client/src/presenter/actions/openCaseDocumentDownloadUrlAction.ts | Typed caught error as any to access .message |
| web-client/src/presenter/actions/isRespondentInCaseAction.ts | Non-null assertion for irsPractitioners array access |
| web-client/src/presenter/actions/isPractitionerInCaseAction.ts | Non-null assertion for privatePractitioners array access |
| web-client/src/presenter/actions/assignSelectedWorkItemsAction.ts | Defaulted assigneeId to empty string for typing |
| web-client/src/presenter/actions/TrialSessionWorkingCopy/setAddEditUserCaseNoteModalStateFromListAction.ts | Non-null assertion for caseDetail.caseCaption |
| web-client/src/presenter/actions/TrialSessionWorkingCopy/generatePrintableTrialSessionCopyReportAction.test.ts | Non-null assertion for judge name access in fixtures |
| web-client/src/presenter/actions/TrialSession/setQcCompleteOnCaseOnTrialSessionAction.ts | Non-null assertion for eligible case update |
| web-client/src/presenter/actions/PendingItems/setupPropsForPrintablePendingReportAction.test.ts | Made generic prop type optional to satisfy strictness |
| web-client/src/presenter/actions/EditDocketRecordEntry/strikeDocketEntryAction.ts | Typed caught error as any to access .message |
| web-client/src/presenter/actions/DocketEntry/suggestSaveForLaterValidationAction.test.ts | Non-null assertion for action output access |
| web-client/src/presenter/actions/CourtIssuedOrder/updateCreateOrderModalFormValueAction.ts | Non-null assertions for order type map lookup |
| web-client/src/presenter/actions/CourtIssuedDocketEntry/clearCourtIssuedDocketEntryFormValuesAction.ts | Non-null assertion for event code lookup |
| web-client/src/presenter/actions/CaseAssociation/validateEditRespondentCounselAction.ts | Non-null assertion for counsel array access |
| web-client/src/presenter/actions/CaseAssociation/validateEditPetitionerCounselAction.ts | Non-null assertion for practitioner array access |
| web-client/src/presenter/actions/CaseAssociation/setRespondentCounselFormAction.ts | Non-null assertion for practitioner lookup |
| web-client/src/presenter/actions/CaseAssociation/setPetitionerCounselFormAction.ts | Non-null assertion for practitioner lookup |
| web-client/src/presenter/actions/CaseAssociation/removeRespondentCounselFromCaseAction.ts | Non-null assertion for practitioner lookup |
| web-client/src/presenter/actions/CaseAssociation/removePetitionerCounselFromCaseAction.ts | Non-null assertion for practitioner lookup |
| web-client/integration-tests/permissions.test.ts | Cast global.window for stricter spread typing |
| web-client/integration-tests/orderSearchJourneyDocketNumber.test.ts | Cast global.window for stricter spread typing |
| web-client/integration-tests/journey/petitionsClerkCreateOrder.ts | Cast first(draftDocuments) to raw docket entry for typing |
| web-client/integration-tests/journey/judgeViewsTrialSessionWorkingCopy.ts | Non-null assertion for found case access |
| web-client/integration-tests/journey/docketClerkViewsNewTrialSession.ts | Non-null assertion for found case access |
| web-client/integration-tests/journey/docketClerkUpdatesCaseStatusTo.ts | Cast compute output to any to satisfy typing |
| web-client/integration-tests/caseJourney.test.ts | Cast global.window for stricter spread typing |
| web-client/integration-tests-public/journey/unauthedUserSeesStrickenDocketEntry.ts | Non-null assertions for found docket entry access |
| web-api/src/lambdas/notifications/connectLambda.ts | Defaulted client connection id to empty string |
| web-api/src/lambdas/api/api.ts | Updated serverless-express invocation to include callback |
| web-api/src/lambdas/api-public/api-public.ts | Simplified handler export to direct serverless-express handler |
| web-api/src/genericHandler.ts | Typed caught error as any to access properties |
| web-api/src/business/useCases/manualAssociation/associatePrivatePractitionerWithCaseInteractor.ts | Added practitioner typing and explicit missing-user error |
| web-api/src/business/useCaseHelper/trialSessions/setNoticeOfChangeOfTrialJudge.ts | Switched to shared imports and cast trial session info type |
| shared/src/tools/helpers.ts | Added this: any typing for stream-like callback usage |
| shared/src/proxies/workitems/assignWorkItemsProxy.ts | Added explicit parameter typing for assign work items proxy |
| shared/src/business/utilities/shouldAppendClinicLetter.ts | Initialized clinicLetterKey to satisfy definite assignment |
| shared/src/business/utilities/shouldAppendClinicLetter.test.ts | Updated expectation to match new default value |
| shared/src/business/utilities/pdfGenerator/documentTemplates/DocketRecord.tsx | Added explicit React prop typing and docket entry typing |
| shared/src/business/utilities/getFormattedCaseDetail.ts | Added FormattedCaseDetailDocketEntry type and refactored formatDocketEntry return typing |
| shared/src/business/utilities/getFormattedCaseDetail.formatDocketEntry.test.ts | Updated test app context import and strict typing casts |
| shared/src/business/useCases/stampMotion/setDocumentTitleFromStampDataInteractor.ts | Made disposition access optional for strict typing |
| shared/src/business/entities/cases/Case.updateStatistic.test.ts | Non-null assertions to satisfy strict array access |
| shared/src/business/entities/cases/Case.updatePrivatePractitioner.test.ts | Non-null assertions to satisfy strict array access |
| shared/src/business/entities/cases/Case.updateIrsPractitioner.test.ts | Non-null assertions to satisfy strict array access |
| shared/src/business/entities/cases/Case.removeRepresentingFromPractitioners.test.ts | Non-null assertions to satisfy strict array access |
| shared/src/business/entities/cases/Case.removePrivatePractitioner.test.ts | Non-null assertions to satisfy strict array access |
| shared/src/business/entities/cases/Case.removeIrsPractitioner.test.ts | Non-null assertions to satisfy strict array access |
| shared/src/business/entities/cases/Case.getSortableDocketNumber.test.ts | Non-null assertions for numeric sort comparator |
| shared/src/business/entities/cases/Case.deleteStatistic.test.ts | Non-null assertions to satisfy strict array access |
| shared/src/business/entities/cases/Case.attachPrivatePractitioner.test.ts | Non-null assertions to satisfy strict array access |
| shared/src/business/entities/cases/Case.attachIrsPractitioner.test.ts | Non-null assertion to satisfy strict array access |
| shared/src/business/entities/cases/Case.archiveDocketEntry.test.ts | Optional chaining added to satisfy strictness in tests |
| shared/src/business/entities/caseAssociation/CaseAssociationRequestDocumentTypeD.ts | Defaulted mapped names array to [] when filers undefined |
| shared/src/business/entities/caseAssociation/CaseAssociationRequestDocumentTypeB.ts | Defaulted mapped names array to [] when filers undefined |
| eslint.config.mjs | Added React version auto-detection setting |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
shared/src/business/useCases/stampMotion/setDocumentTitleFromStampDataInteractor.ts
Outdated
Show resolved
Hide resolved
shared/src/business/utilities/pdfGenerator/documentTemplates/DocketRecord.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
web-client/src/views/StartCaseInternal/ElectronicServiceCheckbox.tsx
Outdated
Show resolved
Hide resolved
…matted case and docket entry types
…ocket entry formatting updates
…ormatting utility and updating tests
…0 typescript errors
…handle having 0 typescript errors...
…handle having 0 typescript errors...
…s callback signatures
|
@copilot Please re-review this PR, thoroughly scrutinizing the claims in the
Why do you think the |
|
For anyone following along, copilot answered my question here: |
…type out of web-client and into shared
…type out of web-client and into shared
…type out of web-client and into shared
…leFormattedCaseDetail I suppose; same for DoubleFormattedDocketEntry
…ty; added test coverage where necessary
… 'as any' from the case and docket entry formatting pipeline
8791 - TS Error Cleanup: Miscellaneous
#8791
Description
This PR resolves a broad set of strict-mode TypeScript compilation errors across the application. No business logic or UI behavior has been changed — all modifications are limited to satisfying type constraints, fixing linter issues, and improving developer tooling. 133 files were touched across
shared/,web-client/,web-api/,cypress/, andscripts/.Key Changes
Typed Case & Docket Entry Formatting Pipeline (
shared/+web-client/)The largest portion of this PR introduces explicit TypeScript types for the formatted case and docket entry objects that flow through the application:
getFormattedCaseDetail.ts:FormattedCaseDetailDocketEntry,FormattedCaseDetail,FormattedCase,FormattedCounsel, and supporting types (PreformattedCaseDetailDocketEntry, etc.) to explicitly describe the shape of objects returned by the case/docket formatting utilities.formattedDocketEntries.ts:FormattedDocketEntry(extendsFormattedCaseDetailDocketEntrywith UI-specific fields likeiconsToDisplay,sealButtonText, etc.),ComputedFormattedDocketEntry,ComputedFormattedCaseDetail, andRelatedDocketEntry.generateDocketRecordPdfInteractor.ts:DocketRecordPdfCaseDetailfor the PDF generation pipeline.any, includingformatCase,formatDocketEntry,formatCaseDetail,sortDocketEntryTable,setupIconsToDisplay, and others.getDescriptionDisplayandgetSealedDocketEntryTooltipto direct imports ingetFormattedCaseDetail.tsto support the refactored formatting pipeline.DocketRecord.tsx(PDF template): Added explicit React prop types for theDocketRecordcomponent and its sub-components.Non-Null Assertions & Strict Typing Fixes (
web-client/)!), optional chaining (?.), defaults (|| [],|| ''), and explicit casts (as any,as RawCase, etc.) across ~60 web-client files including:removePetitionerCounselFromCaseAction,strikeDocketEntryAction,assignSelectedWorkItemsAction, etc.)correspondenceViewerHelper,docketEntryQcHelper,draftDocumentViewerHelper,messageModalHelper,sessionAssignmentHelper, etc.)docketClerkSealsDocketEntry,chambersUserAddsOrderToCase, multiple order-type journeys, etc.)React Component Prop Typings & DOM Interfaces (
web-client/)React.FCprop type definitions for components:InclusionsForm,NonstandardForm,ObjectionsForm,ElectronicServiceCheckbox,IrsNoticeUploadForm,PartiesInformationContentHeader.<div role="form">with semantic<form>element inStartCaseInternal.tsx.FocusLock.tsxto use properly typeduseRef<HTMLDivElement>(null)andHTMLElementcasting for DOM references.Shared Entity & Utility Fixes (
shared/)Case.*.test.tsfiles for strict entity property access (e.g.,irsPractitioners!,privatePractitioners!,statistics!,archivedDocketEntries!).this: anytyping to stream helper inshared/src/tools/helpers.ts.assignWorkItemsProxy.ts.shouldAppendClinicLetter.tsto initializeclinicLetterKeyto empty string (and updated test).dispositionaccess optional insetDocumentTitleFromStampDataInteractor.ts.getPractitionerCasesInteractor.tsforformatCasecalls.CaseAssociationRequestDocumentTypeB.tsandCaseAssociationRequestDocumentTypeD.ts.setNoticeOfChangeOfTrialJudge.tsto use shared imports and casting.Web API Adjustments (
web-api/)connectLambda.ts: DefaultedconnectionIdto empty string for strict null satisfaction.genericHandler.ts: Typed caught error asanyto access.messageproperty.associatePrivatePractitionerWithCaseInteractor.ts: Added practitioner typing and explicit cast.generateDocketRecordPdfInteractor.ts: Added typed pipeline withDocketRecordPdfCaseDetailand updated formatting logic (including new unit tests).Developer Tooling
eslint.config.mjs: Addedsettings.react.version: 'detect'to the flat ESLint config to resolve React version warning logs during linting.scripts/compareTypescriptErrors.ts:countTypescriptErrorsto return0instead of throwing when no errors are found (supports the goal of reaching zero TS errors).validateTscResult()helper to properly diagnosetscprocess failures (error, signal, exit code with no output).Testing
generateDocketRecordPdfInteractorcovering the typed formatting pipeline.What This PR Does NOT Change
Oh Yeah Also