Skip to content

fix: update app type declaration#133

Draft
dcoa wants to merge 1 commit intoopenedx:masterfrom
eduNEXT:dcoa/fix-type-val
Draft

fix: update app type declaration#133
dcoa wants to merge 1 commit intoopenedx:masterfrom
eduNEXT:dcoa/fix-type-val

Conversation

@dcoa
Copy link
Copy Markdown
Contributor

@dcoa dcoa commented Apr 19, 2026

Summary

Important

Needs #131 to use frontend-platform type imports

Tighten TypeScript coverage across the authz module and enable type validation in CI.

CI

  • .github/workflows/ci.yml — added npm run types (tsc --noEmit) step between Lint and Test

tsconfig

  • tsconfig.json — cleaned up config, added ignoreDeprecations: "6.0" to quiet TS 6.0 deprecation warnings on inherited options,
  • dropped obsolete baseUrl + wildcard * path, kept @src/* alias

Type shims (new)

  • src/paragon.d.ts — introduced TableCellValue<T>, DataTableColumn, and DataTableContextShape to type Paragon's loosely-typed
    DataTableContext (declared as Context<{}> upstream) and column shape
  • src/global.d.ts — declarations for untyped deps (lodash.debounce, @edx/frontend-component-header)

Import normalization

Switched 7 bare 'types' imports to '@src/types':

  • src/authz-module/constants.ts
  • src/authz-module/libraries-manager/context.tsx
  • src/authz-module/libraries-manager/LibrariesUserManager.tsx
  • src/authz-module/libraries-manager/components/AssignNewRoleModal/AssignNewRoleModal.tsx + .test.tsx
  • src/authz-module/roles-permissions/courses/constants.ts
  • src/authz-module/roles-permissions/libraries/constants.ts

Removed all @ts-ignore + any casts

  • src/authz-module/audit-user/index.tsx — typed error shape instead of ts-ignore
  • src/authz-module/components/TableControlBar/TableControlBar.tsx — removed @ts-ignore, cast DataTableContext via DataTableContextShape, typed
    handleCloseFilter/handleSetFilters params, narrowed FILTER_CHIPS_ICONS/FILTER_GROUP_TO_ID index access with as keyof typeof, spread props
    cast via React.ComponentProps<typeof X>
  • src/authz-module/components/TableFooter/TableFooter.tsx — same context cast pattern
  • src/authz-module/libraries-manager/components/TeamTable/components/SortDropdown.tsx + TableControlBar.tsx — same context cast pattern
  • src/authz-module/libraries-manager/LibrariesUserManager.tsx — removed role.resources as any[], use typed RoleResourceGroup[]
  • src/authz-module/libraries-manager/LibrariesTeamManager.tsx — removed as any[] cast

Type refinements

  • src/types.ts — removed duplicate AppContextType/TableCellValue (moved/replaced); updated comment
  • src/authz-module/libraries-manager/context.tsx — use React.ContextType<typeof AppContext> instead of custom duplicate
  • src/authz-module/libraries-manager/ToastManagerContext.tsxshowErrorToast(error: unknown, …), widened AppToast.message to string | ReactNode[], typed Bold chunks as ReactNode, narrowed ERROR_TOAST_MAP/messages keys with as keyof typeof
  • src/authz-module/libraries-manager/ErrorPage/index.tsx — typed getErrorConfig params
  • src/authz-module/components/PermissionTable.tsxactionsDictionary[permission.actionKey as ActionKey]
  • src/authz-module/components/RoleCard/index.tsx — typed permissionsByResource as RoleResourceGroup[]
  • src/authz-module/components/ResourceTooltip.tsx — optional chain permission.label?.trim()
  • src/authz-module/components/TableCells.tsxReact.ContextType<typeof AppContext>, rely on shared TableCellValue
  • src/authz-module/components/TableControlBar/SearchFilter.tsx + TeamTable/components/SearchFilter.tsx — widened setFilter to (string | undefined) => void, typed onChange event
  • src/authz-module/components/TableControlBar/MultipleChoiceFilter.tsx + TeamTable/components/MultipleChoiceFilter.tsx — typed value/handler
    params
  • src/authz-module/hooks/useQuerySettings.tsx — derived DataTableFilters type from DataTableContextShape['state']
  • src/authz-module/libraries-manager/utils.ts + roles-permissions/libraries/utils.tsactionMessages[messageKey as keyof typeof actionMessages]
  • src/authz-module/libraries-manager/components/AddNewTeamMemberModal/AddNewTeamMemberModal.tsx — exported AddNewTeamMemberModalProps,
    simplified onChange={handleChangeForm} (removed redundant arrow wrapper)
  • src/authz-module/libraries-manager/components/AddNewTeamMemberModal/AddNewTeamMemberTrigger.tsxmessages[errorMessageId as keyof typeof messages]
  • src/authz-module/libraries-manager/components/AddNewTeamMemberModal/AddNewTeamMemberTrigger.test.tsx — reused exported
    AddNewTeamMemberModalProps for the mock
  • src/authz-module/libraries-manager/components/TeamTable/components/Cells.tsx — imported TableCellValue from @src/paragon, wrapped bare
    string returns in <span> for typed ReactNode consistency
  • src/index.tsx — typed APP_INIT_ERROR subscriber params, use data payload instead of positional error arg
  • src/setupTest.tsx — typed renderWithAllProviders/renderWrapper ui: ReactNode; cast mockAppContext via React.ContextType<typeof AppContext>

Test fixtures

  • src/authz-module/data/hooks.test.tsx, src/data/hooks.test.tsx(getAuthenticatedHttpClient as jest.Mock).mockReturnValue(...)
  • src/authz-module/libraries-manager/utils.test.ts, roles-permissions/libraries/utils.test.tsas unknown as IntlShape for mock intl
  • src/authz-module/team-members/TeamMembersTable.test.tsx — widened mock API response params
  • src/authz-module/components/RoleCard/index.test.tsx — added missing description + resource fields to satisfy
    RoleResourceGroup/PermissionMetadata

Test plan

  • npm run types passes
  • npm run lint passes
  • npm run test passes
  • CI runs the new Types step

LLM usage notice

Built with assistance from Claude.

@openedx-webhooks
Copy link
Copy Markdown

openedx-webhooks commented Apr 19, 2026

Thanks for the pull request, @dcoa!

This repository is currently maintained by @openedx/committers-frontend.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Update the status of your PR

Your PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Apr 19, 2026
@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Apr 19, 2026
@dcoa dcoa changed the title fix type issues fix: update app type declaration Apr 19, 2026
@dcoa dcoa marked this pull request as draft April 19, 2026 05:22
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U

Projects

Status: Waiting on Author

Development

Successfully merging this pull request may close these issues.

3 participants