Skip to content

Re-export MessageDescriptor from the runtime i18n API #300

Description

@arbrandes

Description

runtime/i18n re-exports IntlShape, IntlConfig, and ResolvedIntlConfig, but not MessageDescriptor. Apps that type a message-carrying prop or context value have no way to name that type through @openedx/frontend-base, so they import it from react-intl directly, a package they do not declare and only resolve through hoisting.

src/dashboardConfig/DashboardConfigContext.tsx in frontend-app-instructor-dashboard is the motivating case: its DashboardConfig interface has titleMessage and headerMessage fields. openedx/frontend-app-instructor-dashboard#235 moved that repository's other undeclared react-intl import, IntlShape in src/dataDownloads/utils.ts, over to frontend-base and had to leave this one behind.

Adding type MessageDescriptor to the export list in runtime/i18n/index.ts, alongside the three types already there and surfaced through runtime/index.ts, would close the gap. defineMessages is already exported, so the type describing what it returns arguably should be too.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions